diff --git a/_includes/scripts/post.html b/_includes/scripts/post.html index 90faca2817c..1a21e1daafd 100644 --- a/_includes/scripts/post.html +++ b/_includes/scripts/post.html @@ -56,7 +56,15 @@ } lastScrollTop = scrollTop; } + setTimeout(function() { + }, 100); asideSticky() && (init(), setAside()); + setTimeout(function() { + init(); + $window.on('load', function() { + init(); + }); + }, 2000); $window.on('scroll', function() { asideSticky() && setAside(); }); @@ -64,19 +72,19 @@ setTocClass(); asideSticky() && (init(), setAside(true)); }, 100)); - setTimeout(init, 4000); } function toc() { - var $tocUl = $(''), $tocLi, $headings = $articleContent.find('{{ _toc_selectors }}'), headingsTop = [], + var $tocUl = $(''), $tocLi, $headings = $articleContent.find('{{ _toc_selectors }}'), headingsTop = null, scrolling, activeLast, activeCur, rendered = false; function init() { + headingsTop = []; $headings.each(function() { headingsTop.push(Math.floor($(this).offset().top)); }); } function setActiveHeading(element, disabled) { var scrollTop = $window.scrollTop(), i; - if (disabled || headingsTop.length < 1) { return; } + if (disabled || !headingsTop || headingsTop.length < 1) { return; } if (element) { activeCur = element; } else { @@ -112,10 +120,7 @@ rendered = true; } asideSticky() && (render(), $window.on('load', function() { - setTimeout(function() { - init(); - setActiveHeading(null, scrolling); - }, 1000); + init(); setActiveHeading(null, scrolling); })); $window.on('resize', window.throttle(function() { if (asideSticky()) { diff --git a/test/_posts/2015-01-03-article-with-lot-images.md b/test/_posts/2015-01-03-article-with-lot-images.md new file mode 100644 index 00000000000..3f69394c6b1 --- /dev/null +++ b/test/_posts/2015-01-03-article-with-lot-images.md @@ -0,0 +1,44 @@ +--- +layout: post +title: Test - Article With A Lot Of images +key: 20150103 +tags: Test English +--- + +## TeXt Theme + +![TeXt Theme](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/TeXt-home.png) + +## TeXt Theme Details + +![TeXt Theme Details](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/TeXt-details.png) + +## Color Theme: Default + +![default](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_default.png) + +## Color Theme: Dark + +![dark](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_dark.png) + +## Color Theme: Forest + +![forest](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_forest.png) + +## Color Theme: Ocean + +![ocean](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_ocean.png) + +## Color Theme: Chocolate + +![chocolate](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_chocolate.png) + +## Color Theme: Orange + +![orange](https://raw.githubusercontent.com/kitian616/jekyll-TeXt-theme/master/screenshots/colors_orange.png) + + \ No newline at end of file