fix: firefox scroll

This commit is contained in:
Jean-Baptiste Pasquier 2020-10-14 23:40:08 +02:00
parent 87d60ac76b
commit b5a267d84b

View File

@ -0,0 +1,23 @@
document.addEventListener("DOMContentLoaded", () => {
window.scrollTo(0, 1);
let scrollTop = 1;
let fromTop = () => {
return window.pageYOffset || document.compatMode === "CSS1Compat" && document.documentElement.scrollTop || document.body.scrollTop || 0;
};
let isbody = setInterval(() => {
if (document.body) {
clearInterval(isbody);
scrollTop = fromTop();
window.scrollTo(0, scrollTop === 1 ? 0 : 1);
}
}, 15);
window.addEventListener("load", () => {
setTimeout(() => {
if (fromTop() < 20) {
window.scrollTo(0, scrollTop === 1 ? 0 : 1);
}
}, 0);
});
});