擁有舒適的鞋靴不是夢想
mansway 官網上配置!即可實現夢想
var mybutton = document.getElementById("myBtn");
window.onscroll = function() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
mybutton.style.opacity = 1;
} else {
mybutton.style.opacity = 0;
}
}
mybutton.onclick = function() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
window.addEventListener("scroll", function() {
if (document.body.scrollTop === 0 && document.documentElement.scrollTop === 0) {
mybutton.style.display = "none";
}
});