diff options
Diffstat (limited to 'layouts/partials/journal.html')
-rw-r--r-- | layouts/partials/journal.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/layouts/partials/journal.html b/layouts/partials/journal.html index 95cdfe5..ea7ee66 100644 --- a/layouts/partials/journal.html +++ b/layouts/partials/journal.html @@ -59,6 +59,18 @@ app = new Vue({ document.cookie = "night=0;path=/"; document.body.classList.remove("night"); } + }, + throttle(callback, limit) { + var wait = false; + return function (...args) { + if (!wait) { + callback(...args); + wait = true; + setTimeout(function () { + wait = false; + }, limit); + } + } } }, created() { @@ -123,6 +135,12 @@ app = new Vue({ elem.classList.add("table-responsive"); elem.classList.add("table-hover"); }) + + {{ if and (not (.Params.disableToC) ) (.IsPage) }} + spy(); + window.addEventListener('wheel', this.throttle(spy,200), false); + {{ end }} + }, destroyed() { window.removeEventListener('scroll', this.handleScroll); |