0
How does the scroll works?
i like yo know how can i do a Button to scroll up
1 Odpowiedź
+ 1
Try this:
var scrollUp = document.getElementsByClassName('back-to-top')[0];
window.onscroll = function(){
if(window.pageYOffset >= 400){
scrollUp.style.display = 'block';
}else{
scrollUp.style.display = 'none';
}
}
scrollUp.onclick = function(){
window.scrollTo(0,0);
}