diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css/_partial/_post/_content.scss | 13 | ||||
-rw-r--r-- | src/js/even.js | 42 |
2 files changed, 30 insertions, 25 deletions
diff --git a/src/css/_partial/_post/_content.scss b/src/css/_partial/_post/_content.scss index d291d2b..8bcf700 100644 --- a/src/css/_partial/_post/_content.scss +++ b/src/css/_partial/_post/_content.scss @@ -100,10 +100,15 @@ content: ':'; } - figure figcaption h4 { - color: #b5b5b5; - font-size: 0.9rem; - text-align: center; + figure { + &.center { + text-align: center; + } + + figcaption h4 { + color: #b5b5b5; + font-size: 0.9rem; + } } .task-list { diff --git a/src/js/even.js b/src/js/even.js index 87494c4..783698a 100644 --- a/src/js/even.js +++ b/src/js/even.js @@ -1,9 +1,9 @@ 'use strict' -var Even = {} +const Even = {} Even.backToTop = function () { - var $backToTop = $('#back-to-top') + const $backToTop = $('#back-to-top') $(window).scroll(function () { if ($(window).scrollTop() > 100) { @@ -19,9 +19,9 @@ Even.backToTop = function () { } Even.mobileNavbar = function () { - var $mobileNav = $('#mobile-navbar') - var $mobileNavIcon = $('.mobile-navbar-icon') - var slideout = new Slideout({ + const $mobileNav = $('#mobile-navbar') + const $mobileNavIcon = $('.mobile-navbar-icon') + const slideout = new Slideout({ 'panel': document.getElementById('mobile-panel'), 'menu': document.getElementById('mobile-menu'), 'padding': 180, @@ -49,15 +49,15 @@ Even.mobileNavbar = function () { } Even._initToc = function () { - var SPACING = 20 - var $toc = $('.post-toc') - var $footer = $('.post-footer') + const SPACING = 20 + const $toc = $('.post-toc') + const $footer = $('.post-footer') if ($toc.length) { - var minScrollTop = $toc.offset().top - SPACING - var maxScrollTop = $footer.offset().top - $toc.height() - SPACING + const minScrollTop = $toc.offset().top - SPACING + const maxScrollTop = $footer.offset().top - $toc.height() - SPACING - var tocState = { + const tocState = { start: { 'position': 'absolute', 'top': minScrollTop @@ -73,7 +73,7 @@ Even._initToc = function () { } $(window).scroll(function () { - var scrollTop = $(window).scrollTop() + const scrollTop = $(window).scrollTop() if (scrollTop < minScrollTop) { $toc.css(tocState.start) @@ -85,21 +85,21 @@ Even._initToc = function () { }) } - var HEADERFIX = 30 - var $toclink = $('.toc-link') - var $headerlink = $('.headerlink') + const HEADERFIX = 30 + const $toclink = $('.toc-link') + const $headerlink = $('.headerlink') - var headerlinkTop = $.map($headerlink, function (link) { + const headerlinkTop = $.map($headerlink, function (link) { return $(link).offset().top }) $(window).scroll(function () { - var scrollTop = $(window).scrollTop() + const scrollTop = $(window).scrollTop() - for (var i = 0; i < $toclink.length; i++) { - var isLastOne = i + 1 === $toclink.length - var currentTop = headerlinkTop[i] - HEADERFIX - var nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX + for (let i = 0; i < $toclink.length; i++) { + const isLastOne = i + 1 === $toclink.length + const currentTop = headerlinkTop[i] - HEADERFIX + const nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX if (currentTop < scrollTop && scrollTop <= nextTop) { $($toclink[i]).addClass('active') |