js实现5分钟页面无操作触发弹窗事件示例。
页面X分钟不动弹窗测试function PopWindowAfterXminuteUnmoved(minute) {
var minutes = arguments[0] ? arguments[0] : 3;
var showTime = 60 * minutes;
var time = showTime;
$(document).on('click', function () {
time = showTime;
});
var interCount = setInterval(function () {
time--;
if (time == 0) {
clearInterval(interCount);
ShowMessage();
}
$('#timer').text(time);
}, 1000);
function ShowMessage() {
alert('45486');
}
}
PopWindowAfterXminuteUnmoved(1);
离弹窗还有秒