aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Resources/static/themes/material/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/Resources/static/themes/material/index.js')
-rwxr-xr-xapp/Resources/static/themes/material/index.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js
index 4b194d00..e808d75c 100755
--- a/app/Resources/static/themes/material/index.js
+++ b/app/Resources/static/themes/material/index.js
@@ -24,6 +24,29 @@ const stickyNav = () => {
24 }); 24 });
25}; 25};
26 26
27const articleScroll = () => {
28 const articleEl = $('#article');
29 if (articleEl.length > 0) {
30 $(window).scroll(() => {
31 const s = $(window).scrollTop();
32 const d = $(document).height();
33 const c = $(window).height();
34 const articleElBottom = articleEl.offset().top + articleEl.height();
35 const scrollPercent = (s / (d - c)) * 100;
36 $('.progress .determinate').css('width', `${scrollPercent}%`);
37 const fixedActionBtn = $('.js-fixed-action-btn');
38 const toggleScrollDataName = 'toggle-auto';
39 if ((s + c) > articleElBottom) {
40 fixedActionBtn.data(toggleScrollDataName, true);
41 fixedActionBtn.openFAB();
42 } else if (fixedActionBtn.data(toggleScrollDataName) === true) {
43 fixedActionBtn.data(toggleScrollDataName, false);
44 fixedActionBtn.closeFAB();
45 }
46 });
47 }
48};
49
27$(document).ready(() => { 50$(document).ready(() => {
28 // sideNav 51 // sideNav
29 $('.button-collapse').sideNav(); 52 $('.button-collapse').sideNav();
@@ -44,6 +67,7 @@ $(document).ready(() => {
44 initExport(); 67 initExport();
45 initRandom(); 68 initRandom();
46 stickyNav(); 69 stickyNav();
70 articleScroll();
47 71
48 const toggleNav = (toShow, toFocus) => { 72 const toggleNav = (toShow, toFocus) => {
49 $('.nav-panel-actions').hide(100); 73 $('.nav-panel-actions').hide(100);
@@ -81,12 +105,4 @@ $(document).ready(() => {
81 $('.nav-panels').css('background', 'transparent'); 105 $('.nav-panels').css('background', 'transparent');
82 return false; 106 return false;
83 }); 107 });
84
85 $(window).scroll(() => {
86 const s = $(window).scrollTop();
87 const d = $(document).height();
88 const c = $(window).height();
89 const scrollPercent = (s / (d - c)) * 100;
90 $('.progress .determinate').css('width', `${scrollPercent}%`);
91 });
92}); 108});