mirror of
https://github.com/openvk/openvk
synced 2024-12-23 17:12:01 +03:00
d87277e7e7
Due to the fact that "document.body.scrollTop" was removed from newer browsers, hovering over this button was not displayed. I replaced this with "window.scrollY" which works in newer browsers. I also localized the text on it.
14 lines
No EOL
334 B
JavaScript
14 lines
No EOL
334 B
JavaScript
window.addEventListener("scroll", function(e) {
|
|
if(window.scrollY < 100) {
|
|
document.body.classList.toggle("scrolled", false);
|
|
} else {
|
|
document.body.classList.toggle("scrolled", true);
|
|
}
|
|
});
|
|
|
|
u(".toTop").on("click", function(e) {
|
|
window.scrollTo({
|
|
top: 0,
|
|
behavior: "smooth"
|
|
});
|
|
}); |