Backup Commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
async function changeNavAttach() {
|
||||
if (window.pageYOffset >= sticky) {
|
||||
navbar.classList.add("sticky");
|
||||
navbar.classList.add("ontop");
|
||||
} else {
|
||||
navbar.classList.remove("sticky");
|
||||
navbar.classList.remove("ontop");
|
||||
}
|
||||
}
|
||||
|
||||
async function topForBottomBarProductPreview() {
|
||||
if (window.windowWidth < 1001) {
|
||||
document.getElementById("purchaseSection").style.top = (825 + document.getElementById("productPage").scrollTop) + "px";
|
||||
} else {
|
||||
document.getElementById("purchaseSection").style.top = null;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("productPage").onscroll = function () {
|
||||
topForBottomBarProductPreview();
|
||||
};
|
||||
|
||||
window.onscroll = function () {
|
||||
changeNavAttach();
|
||||
};
|
||||
|
||||
function disableScroll() {
|
||||
window.addEventListener('DOMMouseScroll', preventDefault, false); // older FF
|
||||
window.addEventListener(wheelEvent, preventDefault, wheelOpt); // modern desktop
|
||||
window.addEventListener('touchmove', preventDefault, wheelOpt); // mobile
|
||||
window.addEventListener('keydown', preventDefaultForScrollKeys, false);
|
||||
}
|
||||
|
||||
function enableScroll() {
|
||||
window.removeEventListener('DOMMouseScroll', preventDefault, false);
|
||||
window.removeEventListener(wheelEvent, preventDefault, wheelOpt);
|
||||
window.removeEventListener('touchmove', preventDefault, wheelOpt);
|
||||
window.removeEventListener('keydown', preventDefaultForScrollKeys, false);
|
||||
}
|
||||
|
||||
function preventDefault(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function preventDefaultForScrollKeys(e) {
|
||||
if (keys[e.keyCode]) {
|
||||
preventDefault(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function menu() {
|
||||
var x = document.getElementById("navbar");
|
||||
if (x.className.includes("responsive")) {
|
||||
x.className = x.className.replace(" responsive", "");
|
||||
} else {
|
||||
x.className += " responsive";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user