Edited Scrollbar (WIP)
The Scrollbar anti lag initiative
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
//The first argument are the elements to which the plugin shall be initialized
|
||||
//The second argument has to be at least a empty object or a object with your desired options
|
||||
OverlayScrollbars(document.querySelectorAll('body'), { });
|
||||
});
|
||||
|
||||
$(function() {
|
||||
//The passed argument has to be at least a empty object or a object with your desired options
|
||||
$('body').overlayScrollbars({ });
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/* When the user scrolls down, hide the navbar. When the user scrolls up, show the navbar */
|
||||
$(document).ready(function() {
|
||||
var instance = $('body').overlayScrollbars();
|
||||
var prevScrollpos = instance.scroll().position.y;
|
||||
|
||||
console.log(prevScrollpos);
|
||||
|
||||
window.onscroll = function() {
|
||||
|
||||
var currentScrollPos = instance.scroll().position.y;
|
||||
console.log(currentScrollPos);
|
||||
if (prevScrollpos > currentScrollPos) {
|
||||
$("#header").css({"top" : "0"});
|
||||
} else {
|
||||
$("#header").css({"top" : "-50px"});
|
||||
}
|
||||
|
||||
prevScrollpos = currentScrollPos;
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user