diff options
author | amzrk2 | 2020-04-14 16:56:25 +0800 |
---|---|---|
committer | amzrk2 | 2020-04-14 16:56:25 +0800 |
commit | f78c71572b2bc7f408aca5a5b2843a2cd7e93524 (patch) | |
tree | eefc860462dfe7dc40aa089d663ebe3411b39403 /layouts/partials/scripts.html | |
parent | 971f9bd9155eccdeefe563a3608dc46d2132abab (diff) | |
download | hugo-theme-fuji-f78c71572b2bc7f408aca5a5b2843a2cd7e93524.tar.gz hugo-theme-fuji-f78c71572b2bc7f408aca5a5b2843a2cd7e93524.tar.bz2 hugo-theme-fuji-f78c71572b2bc7f408aca5a5b2843a2cd7e93524.zip |
Add scroll to top button
Diffstat (limited to 'layouts/partials/scripts.html')
-rw-r--r-- | layouts/partials/scripts.html | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index c5efc63..de2e018 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,22 +1,17 @@ +{{ if .Site.Params.scrollTop }} <script> $(function () { var bar = new ProgressBar.Circle('#progress', { color: '#8AA2D3', - strokeWidth: 15, + strokeWidth: 12, trailColor: '#E5E2E4', - trailWidth: 15, + trailWidth: 12, text: { - autoStyleContainer: false + value: '<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"></path></svg>', + autoStyleContainer: false, + style: null }, fill: '#E5E2E4', - step: function (state, circle) { - var value = Math.round(circle.value() * 100); - if (value == 0 || value == 100) { - circle.setText(''); - } else { - circle.setText(value); - } - } }); var scrolled = ($(window).scrollTop() / ($(document).height() - $(window).height() - 1)); bar.animate(scrolled); @@ -30,7 +25,15 @@ bar.set(scrolled); }); }); + $('#container-progress').click(function () { + $('html, body').animate({ + scrollTop: 0 + }, 'slow'); + return false; + }); </script> +{{ end }} +<!-- Vanilla LazyLoad --> <script> var lazyLoadInstance = new LazyLoad({ elements_selector: ".lazy" |