JASON CHAVANNES  

jQuery Timer

Project Home   •   View Demo   •   Download   •   Other Web Development Tutorials


$.timer( [ action ] , [ time ] , [ autostart ] )

action A Function to be called by the timer.

time A Number determining how long between actions in milliseconds.

autostart A Boolean indicating whether to start the timer. Defaults to false.

Usage

timer.set(options)
timer.play(reset)  // Boolean. Defaults to false.
timer.pause()
timer.toggle(reset)  // Boolean. Defaults to false.
timer.stop()  // Pause and resets
timer.reset()
timer.once(time)  // Number. Defaults to 0.
timer.isActive  // Returns true if timer is running

Example

var timer = $.timer(function() {
	alert('This message was sent by a timer.');
});

timer.set({ time : 5000, autostart : true });