forked from ehynds/jquery-idle-timeout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-mint.htm
67 lines (59 loc) · 2.5 KB
/
example-mint.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery Idle Timeout</title>
<style type="text/css">
#idletimeout { background:#CC5100; border:3px solid #FF6500; color:#fff; font-family:arial, sans-serif; text-align:center; font-size:12px; padding:10px; position:relative; top:0px; left:0; right:0; z-index:100000; display:none; }
#idletimeout a { color:#fff; font-weight:bold }
#idletimeout span { font-weight:bold }
</style>
<link rel="stylesheet" type="text/css" href="examples.css" />
</head>
<body>
<div id="idletimeout">
You will be logged off in <span><!-- countdown place holder --></span> seconds due to inactivity.
<a id="idletimeout-resume" href="#">Click here to continue using this web page</a>.
</div>
<div id="bar">
<h1><a href="http://www.erichynds.com">eric<span>hynds</span></a></h1>
<div><a href="http://www.erichynds.com">« Return to Blog Post</a></div>
</div>
<div id="content">
<h2>jQuery Idle Timeout Demo - Mint.com Style</h2>
<p>This idle timeout countdown is triggered after 5 seconds. <strong>Keep your mouse and keyboard still!</strong></p>
<p><img src="http://www.erichynds.com/examples/jquery-idle-timeout/screenshot.gif" alt="Example" /></p>
<p>A polling request is sent to the server every two seconds to keep the server side session alive. I've set this parameter to an <em>extremely</em> low number
for demo purposes (timeout is only 5 seconds), but in reality, this should be much higher.</p>
<p>View source to see markup & CSS.</p>
<ul>
<li><a href="example-dialog.htm">View the jQuery UI dialog example</a></li>
<li><a href="http://github.com/ehynds/jquery-idle-timeout">Download & follow on GitHub</a></li>
<li><a href="http://www.erichynds.com">Return to home page</a>
</ul>
</div>
<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>
</body>
</html>