diff options
author | Simounet <contact@simounet.net> | 2020-01-19 17:49:54 +0100 |
---|---|---|
committer | Simounet <contact@simounet.net> | 2020-01-21 14:06:08 +0100 |
commit | dc23bf9f29b2cff5c27ee8d2d251f435d00e6652 (patch) | |
tree | 0da66ea37e4eb54741aab6f5b1dbf5fa9966fa28 /app/Resources/static | |
parent | cfd77d1c2abca28c346af4697fb92db98a42f40a (diff) | |
download | wallabag-dc23bf9f29b2cff5c27ee8d2d251f435d00e6652.tar.gz wallabag-dc23bf9f29b2cff5c27ee8d2d251f435d00e6652.tar.zst wallabag-dc23bf9f29b2cff5c27ee8d2d251f435d00e6652.zip |
Entry action buttons displayed on page end reached
Diffstat (limited to 'app/Resources/static')
-rw-r--r-- | app/Resources/static/themes/material/css/article.scss | 1 | ||||
-rwxr-xr-x | app/Resources/static/themes/material/index.js | 32 |
2 files changed, 25 insertions, 8 deletions
diff --git a/app/Resources/static/themes/material/css/article.scss b/app/Resources/static/themes/material/css/article.scss index f1a11da0..755372c9 100644 --- a/app/Resources/static/themes/material/css/article.scss +++ b/app/Resources/static/themes/material/css/article.scss | |||
@@ -5,6 +5,7 @@ | |||
5 | #article { | 5 | #article { |
6 | font-size: 20px; | 6 | font-size: 20px; |
7 | margin: 0 auto; | 7 | margin: 0 auto; |
8 | padding-bottom: 80px; | ||
8 | max-width: 45em; | 9 | max-width: 45em; |
9 | 10 | ||
10 | article { | 11 | article { |
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 | ||
27 | const 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 | }); |