let timer = 300,showTimer=timer,interCount
let interCount = setInterval(()=>{
timer--
if(timer == 0){
timer=showTimer
// 300秒后执行事件,且时间重置
}
},1000)
// 任何操作都重置时间
$(document).bind('click',function(){timer=showTimer;})
$(document).bind('keydown',function(){timer=showTimer;})
$(document).bind('mousemove',function(){timer=showTimer;})
$(document).bind('mousewheel',function(){timer=showTimer;})
$(document).bind('scroll',function(){timer=showTimer;})
注意:离开页面要清除定时器