summaryrefslogtreecommitdiffstats
path: root/layouts/partials/scripts.html
diff options
context:
space:
mode:
authoramzrk22020-04-14 15:46:26 +0800
committeramzrk22020-04-14 15:46:26 +0800
commit971f9bd9155eccdeefe563a3608dc46d2132abab (patch)
tree91fdc409de78f76fc79287ec67412fa1cff12968 /layouts/partials/scripts.html
parent4d07aeee876efb805739ee90120bc903a02e342b (diff)
downloadhugo-theme-fuji-971f9bd9155eccdeefe563a3608dc46d2132abab.tar.gz
hugo-theme-fuji-971f9bd9155eccdeefe563a3608dc46d2132abab.tar.bz2
hugo-theme-fuji-971f9bd9155eccdeefe563a3608dc46d2132abab.zip
Add progess bar
Diffstat (limited to 'layouts/partials/scripts.html')
-rw-r--r--layouts/partials/scripts.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 4caf7ba..c5efc63 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -1,4 +1,37 @@
<script>
+ $(function () {
+ var bar = new ProgressBar.Circle('#progress', {
+ color: '#8AA2D3',
+ strokeWidth: 15,
+ trailColor: '#E5E2E4',
+ trailWidth: 15,
+ text: {
+ autoStyleContainer: false
+ },
+ 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);
+ $(window).scroll(function () {
+ scrolled = ($(window).scrollTop() / ($(document).height() - $(window).height() - 1));
+ if (scrolled < 0.0005) {
+ scrolled = 0;
+ } else if (scrolled > 1) {
+ scrolled = 1;
+ }
+ bar.set(scrolled);
+ });
+ });
+</script>
+<script>
var lazyLoadInstance = new LazyLoad({
elements_selector: ".lazy"
});