mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-05 14:28:40 +00:00
Merge pull request #4255 from Simounet/feat/actions-from-sticky-btn
Feat/actions from sticky btn
This commit is contained in:
commit
7937ed0c20
6 changed files with 43 additions and 13 deletions
|
@ -5,6 +5,7 @@
|
||||||
#article {
|
#article {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
padding-bottom: 80px;
|
||||||
max-width: 45em;
|
max-width: 45em;
|
||||||
|
|
||||||
article {
|
article {
|
||||||
|
|
|
@ -131,6 +131,11 @@ nav {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.entry-nav-top--sticky {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 993px) {
|
@media (min-width: 993px) {
|
||||||
.button-collapse {
|
.button-collapse {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -17,6 +17,36 @@ import './js/shortcuts/entry';
|
||||||
/* Theme style */
|
/* Theme style */
|
||||||
import './css/index.scss';
|
import './css/index.scss';
|
||||||
|
|
||||||
|
const stickyNav = () => {
|
||||||
|
const nav = $('.js-entry-nav-top');
|
||||||
|
$('[data-toggle="actions"]').click(() => {
|
||||||
|
nav.toggleClass('entry-nav-top--sticky');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const articleScroll = () => {
|
||||||
|
const articleEl = $('#article');
|
||||||
|
if (articleEl.length > 0) {
|
||||||
|
$(window).scroll(() => {
|
||||||
|
const s = $(window).scrollTop();
|
||||||
|
const d = $(document).height();
|
||||||
|
const c = $(window).height();
|
||||||
|
const articleElBottom = articleEl.offset().top + articleEl.height();
|
||||||
|
const scrollPercent = (s / (d - c)) * 100;
|
||||||
|
$('.progress .determinate').css('width', `${scrollPercent}%`);
|
||||||
|
const fixedActionBtn = $('.js-fixed-action-btn');
|
||||||
|
const toggleScrollDataName = 'toggle-auto';
|
||||||
|
if ((s + c) > articleElBottom) {
|
||||||
|
fixedActionBtn.data(toggleScrollDataName, true);
|
||||||
|
fixedActionBtn.openFAB();
|
||||||
|
} else if (fixedActionBtn.data(toggleScrollDataName) === true) {
|
||||||
|
fixedActionBtn.data(toggleScrollDataName, false);
|
||||||
|
fixedActionBtn.closeFAB();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
// sideNav
|
// sideNav
|
||||||
$('.button-collapse').sideNav();
|
$('.button-collapse').sideNav();
|
||||||
|
@ -36,6 +66,8 @@ $(document).ready(() => {
|
||||||
initFilters();
|
initFilters();
|
||||||
initExport();
|
initExport();
|
||||||
initRandom();
|
initRandom();
|
||||||
|
stickyNav();
|
||||||
|
articleScroll();
|
||||||
|
|
||||||
const toggleNav = (toShow, toFocus) => {
|
const toggleNav = (toShow, toFocus) => {
|
||||||
$('.nav-panel-actions').hide(100);
|
$('.nav-panel-actions').hide(100);
|
||||||
|
@ -73,12 +105,4 @@ $(document).ready(() => {
|
||||||
$('.nav-panels').css('background', 'transparent');
|
$('.nav-panels').css('background', 'transparent');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).scroll(() => {
|
|
||||||
const s = $(window).scrollTop();
|
|
||||||
const d = $(document).height();
|
|
||||||
const c = $(window).height();
|
|
||||||
const scrollPercent = (s / (d - c)) * 100;
|
|
||||||
$('.progress .determinate').css('width', `${scrollPercent}%`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="determinate"></div>
|
<div class="determinate"></div>
|
||||||
</div>
|
</div>
|
||||||
<nav class="hide-on-large-only">
|
<nav class="hide-on-large-only js-entry-nav-top">
|
||||||
<div class="nav-panel-item cyan darken-1">
|
<div class="nav-panel-item cyan darken-1">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
@ -280,8 +280,8 @@
|
||||||
{{ entry.content | raw }}
|
{{ entry.content | raw }}
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<div class="fixed-action-btn horizontal click-to-toggle hide-on-large-only">
|
<div class="fixed-action-btn js-fixed-action-btn horizontal click-to-toggle hide-on-large-only">
|
||||||
<a class="btn-floating btn-large">
|
<a class="btn-floating btn-large" data-toggle="actions">
|
||||||
<i class="material-icons">menu</i>
|
<i class="material-icons">menu</i>
|
||||||
</a>
|
</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue