$('a.anchor').on('click', function(e) {
// Workaround for bad TOC markers.
if ($(this).closest('#toc').length) return;
+ if ($(this).closest('.toc').length) return;
if ($(this).closest('#wltoc').length) return;
e.preventDefault();
history.pushState({}, '', anchor);
},
});
+ return true;
}
}
}
scrollToAnchor(window.location.hash)
- $('#toc, #themes, #book-text, #annotation').on('click', 'a', function(event) {
- event.preventDefault();
- scrollToAnchor($(this).attr('href'));
+ $('#toc, #themes, #book-text, #annotation, .scroll').on('click', 'a', function(event) {
+ if (scrollToAnchor($(this).attr('href'))) {
+ event.preventDefault();
+ }
});
-
})})(jQuery);