Made Gumshoe contingent upon a TOC being present. This prevents a console error on pages without a TOC. (#2124)

This commit is contained in:
Jeckari 2019-04-12 08:42:10 -07:00 committed by Michael Rose
parent 44760c989e
commit cf0c046dd2
2 changed files with 17 additions and 18 deletions

View file

@ -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
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
// 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
});
// 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']"

File diff suppressed because one or more lines are too long