Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Tweak JS for omitting certain header elemenst from AnchorJS functiona…
Browse files Browse the repository at this point in the history
…lity, add explanatory comments.
  • Loading branch information
tadhg-ohiggins committed Nov 21, 2016
1 parent a361e1f commit 735e114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions _pages/index.html
Expand Up @@ -11,6 +11,10 @@
<a class="a-skip-to-main" href="#main">Skip to main content</a>
<header role="banner" class="site-header">
<div class="wrapper">
<!-- This h1 element has this id because, unless we set it here,
kramdown will populate it with a value based on the content of the
element, which results in "18f-content-guide", which is an invalid
value due to its starting with a numeral. -->
<h1 id="title-18f-content-guide">{{site.title}}</h1>
<p>{{site.description}}</p>
{% jekyll_pages_api_search_interface %}
Expand Down
8 changes: 5 additions & 3 deletions javascripts/application.js
Expand Up @@ -114,10 +114,12 @@ $(document).ready(function() {
// Add anchorJS anchors; see https://github.com/18F/content-guide/issues/149
anchors.options.placement = 'right';
anchors.add();
// Our logo is an h1 element but shouldn't have a visible anchor link:
anchors.remove(".logo");
anchors.remove("#title-18f-content-guide");
anchors.remove("ol li h1");

// The header elements in the table of contents shouldn't have anchor links:
anchors.remove(".layout-table-of-contents h1")
// The page-title header elements shouldn't have anchor links:
anchors.remove(".page-title")
});

document.addEventListener('DOMContentLoaded', function() {
Expand Down

0 comments on commit 735e114

Please sign in to comment.