Use to create on-screen count-up timers that can be paused, stopped, reset, etc. Displayed precision is to the second. Note that the timer is intended to fairly accurately express the passage of time without killing the performance of the page in which it is running.  To this end, a single interval triggers each second and updates all timers on the page.


<span id="testTimerContainer"></span>
$("#testTimerContainer").timer({persistExisting: true,
	maximumSeconds: 300,
	timeoutHandler: function(jElement) { alert("Timeout"); }});


  • persistExisting - Inidicates whether any elements being assigned a timer that are determined to already contain a timer should be left alone (true) or have the existing timer replaced (false). (Default = true) This allows you to not have to worry about which places on a page already have timers and which do not. You can just select all elements in which timers should be displayed and specify true. Then, no existing timers will be affected.
  • maximumSeconds - The maximum number of seconds that any one timer will run before it stops and the timeout handler is called. -1 indicates no maximum. (Default = -1)
  • timeoutHandler - A function to call for each timer that times out. The jQuery element in which the expiring timer resides is passed as the only argument to the function. (Default = empty function)

Last edited Jul 16, 2012 at 9:41 PM by cmaterick, version 5


No comments yet.