Skip to content

Commit

Permalink
Made Gumshoe contingent upon a TOC being present. This prevents a con…
Browse files Browse the repository at this point in the history
…sole error on pages without a TOC. (#2124)
  • Loading branch information
Jeckari authored and mmistakes committed Apr 12, 2019
1 parent 44760c9 commit cf0c046
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
36 changes: 19 additions & 17 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,25 @@ $(document).ready(function() {
});

// Gumshoe scroll spy init
var spy = new Gumshoe("nav.toc a", {
// Active classes
navClass: "active", // applied to the nav list item
contentClass: "active", // applied to the content

// Nested navigation
nested: false, // if true, add classes to parents of active link
nestedClass: "active", // applied to the parent items

// Offset & reflow
offset: 20, // how far from the top of the page to activate a content area
reflow: true, // if true, listen for reflows

// Event support
events: true // if true, emit custom events
});

if($("nav.toc").length > 0) {
var spy = new Gumshoe("nav.toc a", {
// Active classes
navClass: "active", // applied to the nav list item
contentClass: "active", // applied to the content

// Nested navigation
nested: false, // if true, add classes to parents of active link
nestedClass: "active", // applied to the parent items

// Offset & reflow
offset: 20, // how far from the top of the page to activate a content area
reflow: true, // if true, listen for reflows

// Event support
events: true // if true, emit custom events
});
}

// add lightbox class to all image links
$(
"a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']"
Expand Down
Loading

0 comments on commit cf0c046

Please sign in to comment.