oBtn.onclick?=?function(){
????????????//設置定時器
????????????timer?=?setInterval(function(){
????????????????//獲取滾動條距離頂部的距離
????????????????var?oTop?=?document.documentElement.scrollTop?||?document.body.scrollTop;
????????????????var?iSpeed?=?Math.floor(-oTop?/?6);
????????????????document.documentElement.scrollTop?=?document.body.scrollTop?=?oTop?+?iSpeed;
????????????????iTop?=?true;
????????????????if(oTop?==?0){
????????????????????clearInterval(timer);
????????????????}
????????????},?30);
????????}這段代碼中,document.documentElement.scrollTop?=?document.body.scrollTop?=?oTop?+?iSpeed;為什么替換為oTop?=?oTop?+?iSpeed;是錯的?
回到頂部中,關于scrollTop部分代碼問題?
ChirsX3405375
2016-09-25 10:26:53