mirror of
https://github.com/carsonip/hugo-theme-minos
synced 2025-12-29 19:09:50 -08:00
Merge pull request #4 from kaushalmodi/fix-smarttoc-js
Move the onScroll function definition to above its call
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user