mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 11:01:04 +00:00
Entry action buttons displayed on page end reached
This commit is contained in:
parent
cfd77d1c2a
commit
dc23bf9f29
5 changed files with 28 additions and 11 deletions
|
@ -5,6 +5,7 @@
|
|||
#article {
|
||||
font-size: 20px;
|
||||
margin: 0 auto;
|
||||
padding-bottom: 80px;
|
||||
max-width: 45em;
|
||||
|
||||
article {
|
||||
|
|
|
@ -24,6 +24,29 @@ const stickyNav = () => {
|
|||
});
|
||||
};
|
||||
|
||||
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(() => {
|
||||
// sideNav
|
||||
$('.button-collapse').sideNav();
|
||||
|
@ -44,6 +67,7 @@ $(document).ready(() => {
|
|||
initExport();
|
||||
initRandom();
|
||||
stickyNav();
|
||||
articleScroll();
|
||||
|
||||
const toggleNav = (toShow, toFocus) => {
|
||||
$('.nav-panel-actions').hide(100);
|
||||
|
@ -81,12 +105,4 @@ $(document).ready(() => {
|
|||
$('.nav-panels').css('background', 'transparent');
|
||||
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}%`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -280,7 +280,7 @@
|
|||
{{ entry.content | raw }}
|
||||
</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" data-toggle="actions">
|
||||
<i class="material-icons">menu</i>
|
||||
</a>
|
||||
|
|
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