mirror of
https://github.com/friendica/friendica
synced 2024-11-18 16:23:41 +00:00
Merge pull request #8271 from MrPetovan/bug/8229-frio-mobile-back-to-top
[frio] Improve back to top button behavior at bottom of page
This commit is contained in:
commit
8293d5ed0a
1 changed files with 13 additions and 3 deletions
|
@ -3,11 +3,21 @@ var jotcache = ''; //The jot cache. We use it as cache to restore old/original j
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
//fade in/out based on scrollTop value
|
//fade in/out based on scrollTop value
|
||||||
|
var scrollStart;
|
||||||
|
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
if ($(this).scrollTop() > 1000) {
|
let currentScroll = $(this).scrollTop();
|
||||||
$("#back-to-top").fadeIn();
|
|
||||||
} else {
|
// Top of the page or going down = hide the button
|
||||||
|
if (!scrollStart || !currentScroll || currentScroll > scrollStart) {
|
||||||
$("#back-to-top").fadeOut();
|
$("#back-to-top").fadeOut();
|
||||||
|
scrollStart = currentScroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Going up enough = show the button
|
||||||
|
if (scrollStart - currentScroll > 100) {
|
||||||
|
$("#back-to-top").fadeIn();
|
||||||
|
scrollStart = currentScroll;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue