From 71c937469cf279bd11c768671def4fc7a3e3e710 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Sun, 26 Feb 2017 15:24:14 -0500 Subject: [PATCH] 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 --- layouts/partials/article.html | 14 +++++++------- 1 file 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 = ''; + }); } })();