show "back to top" only when needed
This commit is contained in:
parent
6162b3fcae
commit
b30754a243
1 changed files with 27 additions and 15 deletions
|
|
@ -33,6 +33,18 @@ var Cl = window.Cl || {};
|
|||
'lowerThan': 'boxShadow'
|
||||
});
|
||||
}
|
||||
// custom functions "botsicode"
|
||||
const backTop = document.querySelector('.list-inline .pull-right'),
|
||||
bodyContainer = document.querySelector('body>div.container'),
|
||||
shBackTop = function() {
|
||||
if (backTop && bodyContainer) {
|
||||
backTop.style.opacity = +(bodyContainer.offsetTop + bodyContainer.getBoundingClientRect().height > window.innerHeight);
|
||||
}
|
||||
};
|
||||
$(window).resize(shBackTop);
|
||||
$(window).scroll(shBackTop);
|
||||
shBackTop();
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Reference in a new issue