Idle Timer

Idle Timer
Idle Timer 插件

空闲插件为您提供了一个监视用户页面活动的方法。空闲是指不移动鼠标、滚动鼠标滚轮和不使用键盘。

5秒内不要移动鼠标

有两种方法来实例化。无论是静态的,或是一个元素。元素结合定时器只会关注他们里面的事件。您可能只需要页级活动,其中你可以设置你的定时器在 document, document.documentElement, 和 document.body. 实例化返回jQuery链接.

使用举例

$(function()
    // Set idle time
    $( document ).idleTimer( 5000 );
});

$(function()
    $( document ).on( "idle.idleTimer", function(event, elem, obj)
        // function you want to fire when the user goes idle
    });

    $( document ).on( "active.idleTimer", function(event, elem, obj, triggerevent)
        // function you want to fire when the user becomes active again
    });

});