var timer = null,
out = null,
t1 = 0,
t2 = 0;
document.onscroll= function(){
if (getscroll() > 200) {
$(".scroll_top").fadeIn();
clearTimeout(out);
t1 = getscroll();
// console.log("t1=" + t1);
out= setTimeout(stopscroll,4000);
} else {
$(".scroll_top").fadeOut();
}
};
function stopscroll() {
t2 = getscroll();
console.log("t2=" + t2);
console.log("t1=" + t1);
if (t2 === t1) {
// console.log('按鈕消失了')
$(".scroll_top").fadeOut();
}
}
function getscroll() {
return document.body.scrollTop || document.documentElement.scrollTop;
}
//點(diǎn)擊跳至網(wǎng)頁(yè)頂部
$(".scroll_top").click(function() {
$(document).scrollTop(0);
})

都是血汗,請(qǐng)給我個(gè)贊.png