aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Resources
diff options
context:
space:
mode:
Diffstat (limited to 'app/Resources')
-rw-r--r--app/Resources/static/themes/material/css/article.scss1
-rw-r--r--app/Resources/static/themes/material/css/nav.scss5
-rwxr-xr-xapp/Resources/static/themes/material/index.js40
3 files changed, 38 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/css/nav.scss b/app/Resources/static/themes/material/css/nav.scss
index 147f163f..b7288278 100644
--- a/app/Resources/static/themes/material/css/nav.scss
+++ b/app/Resources/static/themes/material/css/nav.scss
@@ -131,6 +131,11 @@ nav {
131 display: none; 131 display: none;
132} 132}
133 133
134.entry-nav-top--sticky {
135 position: sticky;
136 top: 0;
137}
138
134@media (min-width: 993px) { 139@media (min-width: 993px) {
135 .button-collapse { 140 .button-collapse {
136 display: none; 141 display: none;
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js
index 2926cad1..e808d75c 100755
--- a/app/Resources/static/themes/material/index.js
+++ b/app/Resources/static/themes/material/index.js
@@ -17,6 +17,36 @@ import './js/shortcuts/entry';
17/* Theme style */ 17/* Theme style */
18import './css/index.scss'; 18import './css/index.scss';
19 19
20const stickyNav = () => {
21 const nav = $('.js-entry-nav-top');
22 $('[data-toggle="actions"]').click(() => {
23 nav.toggleClass('entry-nav-top--sticky');
24 });
25};
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
20$(document).ready(() => { 50$(document).ready(() => {
21 // sideNav 51 // sideNav
22 $('.button-collapse').sideNav(); 52 $('.button-collapse').sideNav();
@@ -36,6 +66,8 @@ $(document).ready(() => {
36 initFilters(); 66 initFilters();
37 initExport(); 67 initExport();
38 initRandom(); 68 initRandom();
69 stickyNav();
70 articleScroll();
39 71
40 const toggleNav = (toShow, toFocus) => { 72 const toggleNav = (toShow, toFocus) => {
41 $('.nav-panel-actions').hide(100); 73 $('.nav-panel-actions').hide(100);
@@ -73,12 +105,4 @@ $(document).ready(() => {
73 $('.nav-panels').css('background', 'transparent'); 105 $('.nav-panels').css('background', 'transparent');
74 return false; 106 return false;
75 }); 107 });
76
77 $(window).scroll(() => {
78 const s = $(window).scrollTop();
79 const d = $(document).height();
80 const c = $(window).height();
81 const scrollPercent = (s / (d - c)) * 100;
82 $('.progress .determinate').css('width', `${scrollPercent}%`);
83 });
84}); 108});