js实现5分钟页面无操作触发弹窗事件示例。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>页面X分钟不动弹窗测试</title>
<script src="https://www.feishuai.vip/js/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
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;
</script>
离弹窗还有<span id="timer"></span>秒
</body>
</html>