本文介绍了闲置5分钟后如何更改页面位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望如果我的页面上5分钟没有任何活动,那么该页面将被重定向到预定义页面.
I want that if there is no activity on my page for 5 mins then the page will be redirected to a predefined page.
任何人都可以建议我如何使用JavaScript或jQuery.
Can anyone suggest me how to do this using JavaScript or jQuery.
推荐答案如果您想要一个真正的非活动控件,请使用此库(该控件也可以控制鼠标和键盘活动) )
If you want a real inactivity control please use this library (which control mouse and keyboard activity too)
jQuery空闲计时器
The jQuery idletimer
paulirish/2009/jquery-idletimer-plugin/
这里是使用示例:
// idleTimer() takes an optional argument that defines the idle timeout // timeout is in milliseconds; defaults to 30000 $.idleTimer(10000); $(document).bind("idle.idleTimer", function(){ // function you want to fire when the user goes idle }); $(document).bind("active.idleTimer", function(){ // function you want to fire when the user becomes active again }); // pass the string 'destroy' to stop the timer $.idleTimer('destroy');更多推荐
闲置5分钟后如何更改页面位置
发布评论