问题描述
我想在此处使用此插件会显示一条消息,指出您是否要继续进行会话,否则该会话将超时.它几乎是由eric hynds创建的一个插件,如果用户在一段时间内不使用计算机,则无论用户是否希望继续使用它,它都会显示一条消息.如果是,则继续,如果不是,则用户超时.
I want to use this plugin here which displays a message stating if you want to continue with session or that session would be timed out. Pretty much it is a plug created by eric hynds where if the user does not use the computer for a period amount of time, then it will display a message if user wants to continue or not. If yes then continue, if not then user is timed out.
但是无论如何,我的问题是要能够使用此插件,我需要什么文件?有一个带有2个js脚本的src文件夹,但我不知道id我需要其中一个还是两个都需要,所以我想问问使用过此插件的人.
But anyway my question is that to be able to use this pluging, what files do I need? There is a src folder with 2 js scripts but I don't know id I need one of them or both of them, so I thought of asking people who have used this plugin.
如果我想将该插件用于多个文档,那我是否要给它们提供不同的ID/类名?
Also if I want to use the plugin for multiple documents then do I just give them different id/class names?
谢谢
推荐答案
只需在演示页面的源代码:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"
type="text/javascript"></script>
<script src="src/jquery.idletimer.js" type="text/javascript"></script>
<script src="src/jquery.idletimeout.js" type="text/javascript"></script>
<script type="text/javascript">
$.idleTimeout('#idletimeout', '#idletimeout a', {
idleAfter: 5,
pollingInterval: 2,
keepAliveURL: 'keepalive.php',
serverResponseEquals: 'OK',
onTimeout: function () {
$(this).slideUp();
window.location = "timeout.htm";
},
onIdle: function () {
$(this).slideDown(); // show the warning bar
},
onCountdown: function (counter) {
$(this).find("span").html(counter); // update the counter
},
onResume: function () {
$(this).slideUp(); // hide the warning bar
}
});
</script>
这篇关于如何使用eric hynds空闲超时插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!