diff options
author | Carson Ip <carsonip@users.noreply.github.com> | 2017-02-26 23:55:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-26 23:55:57 +0300 |
commit | 7459a3f0e1a282b68dce4d715f9a480130d6c366 (patch) | |
tree | f116ce56127e175420ef980e9a24c4160373b05b | |
parent | eadc8b400f3ab77ede06d6b70406188a236d1af1 (diff) | |
parent | 71c937469cf279bd11c768671def4fc7a3e3e710 (diff) |
Merge pull request #4 from kaushalmodi/fix-smarttoc-js
Move the onScroll function definition to above its call
-rw-r--r-- | layouts/partials/article.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/layouts/partials/article.html b/layouts/partials/article.html index def6103..39674f1 100644 --- a/layouts/partials/article.html +++ b/layouts/partials/article.html @@ -49,13 +49,6 @@ if ($toc.length > 0) { var $window = $(window); - $window.on('scroll', onScroll); - $(document).ready(function() { - $toc.find('a').parent('li').find('ul').hide(); - onScroll(); - document.getElementsByClassName('article-toc')[0].style.display = ''; - }); - function onScroll(){ var currentScroll = $window.scrollTop(); var h = $('.article-entry h1, .article-entry h2, .article-entry h3, .article-entry h4, .article-entry h5, .article-entry h6'); @@ -76,6 +69,13 @@ $(e).children('a').addClass('active').siblings('ul').show(); }); } + + $window.on('scroll', onScroll); + $(document).ready(function() { + $toc.find('a').parent('li').find('ul').hide(); + onScroll(); + document.getElementsByClassName('article-toc')[0].style.display = ''; + }); } })(); </script> |