mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 18:13:01 +05:30
(refactor): separated js configs for components in /assets/js/
This commit is contained in:
18
htdocs/assets/js/floatingbar-config.js
Normal file
18
htdocs/assets/js/floatingbar-config.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//---controls the bottom floating bar behaviour
|
||||
let lastScrollTop = 0;
|
||||
|
||||
window.addEventListener("scroll", function () {
|
||||
const st = window.pageYOffset || document.documentElement.scrollTop;
|
||||
|
||||
if (st > lastScrollTop) {
|
||||
// Scrolling down
|
||||
document.getElementById("floating-bar").classList.add("floatingbar-slide-down");
|
||||
document.getElementById("floating-bar").classList.remove("floatingbar-slide-up");
|
||||
} else {
|
||||
// Scrolling up
|
||||
document.getElementById("floating-bar").classList.remove("floatingbar-slide-down");
|
||||
document.getElementById("floating-bar").classList.add("floatingbar-slide-up");
|
||||
}
|
||||
|
||||
lastScrollTop = st <= 0 ? 0 : st;
|
||||
});
|
||||
4
htdocs/assets/js/preloader-config.js
Normal file
4
htdocs/assets/js/preloader-config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
//---controls the page preloader behaviour
|
||||
window.addEventListener("load", function(){
|
||||
$('#preloader').addClass('hidden');
|
||||
});
|
||||
Reference in New Issue
Block a user