diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/js/toc.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/static/js/toc.js b/static/js/toc.js index 2c5b9fb..075a09e 100644 --- a/static/js/toc.js +++ b/static/js/toc.js @@ -1,9 +1,13 @@ $().ready(function(){ + var elems = $(":header"); + if (elems.length == 0) { + return; + } $(window).bind('scroll', function() { var currentTop = $(window).scrollTop(); var currentBottom = $(window).scrollTop() + $(window).height(); var pageBottom = $('#EOF').offset().top; - var elems = $(":header"); + elems.each(function(idx){ var elemTop = $(this).offset().top; var id = $(this).attr('id'); |