Move the onScroll function definition to above its call

This fix was needed for the smart TOC feature to work on Firefox 45.0.1

https://github.com/carsonip/hugo-theme-minos/issues/1#issuecomment-282579296
This commit is contained in:
Kaushal Modi
2017-02-26 15:24:14 -05:00
parent eadc8b400f
commit 71c937469c

View File

@@ -49,13 +49,6 @@
if ($toc.length > 0) { if ($toc.length > 0) {
var $window = $(window); 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(){ function onScroll(){
var currentScroll = $window.scrollTop(); var currentScroll = $window.scrollTop();
var h = $('.article-entry h1, .article-entry h2, .article-entry h3, .article-entry h4, .article-entry h5, .article-entry h6'); 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(); $(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> </script>