为什么这个 ”点击回到顶部按钮后 滑动滑轮的效果“ 在 IE可以 在chrom 里不行
window.onload = function(){
var hiee = document.documentElement.clientHeight;
var timer=null;
var btn = document.getElementById("btn");
var isT = true;
window.onscroll = function(){
var ttop = document.documentElement.scrollTop || document.body.scrollTop;
if(ttop >= hiee){
btn.style.display= "block";
}else{
btn.style.display= "none";
}
if(!isT){
clearInterval(timer);
}
isT = false;
}
btn.onclick = function(){
timer = setInterval(function(){
var ttop = document.documentElement.scrollTop||document.body.scrollTop;
var ispeed = Math.floor(-ttop / 6);
document.documentElement.scrollTop = document.body.scrollTop = ispeed +ttop;
//document.documentElement.scrollTop = document.body.scrollTop = ttop - ttop/50;
// = function(){clearInterval(timer)}
isT = true;
if( ttop == 0){
clearInterval(timer)
}
},10)
}
}