X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/102acc0b6eb715826f26b5082611604cf6ebe240..89881ffd8c2da92f115f23b002f48b7e626014d0:/src/wolnelektury/static/js/book_text/references.js diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js index 3f5b7e37f..394ec3ffd 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -610,6 +610,7 @@ $('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(); @@ -662,14 +663,15 @@ 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);