timeout, a setTimeout wrapper for jQuery

Timeout is a simple jQuery plugin that allows you to delay the execution of code for a certain number of milliseconds. It works like the jQuery delay plugin http://www.evanbot.com/article/jquery-delay-plugin/4 which i didn't know existed at the time I wrote this plugin.

plugin code

timeout a setTimeout wrapper for jQuery
By: Jesse Baird - jebaird.com
	$.fn.timeout = function(options) {  
		var defaults = {timeout:'2000',callback:function(){return true;}}; 
		var options = $.extend(defaults, options);  
		return this.each(function() {
			var e=$(this)[0];


//this will hide all of the anchor tags after 2 seconds
$('a').timeout({timeout:2000,callback:function(){$(this).hide(); }}); 

//hide the drop down menu after 2 seconds

			$("#topNav li ul").bind('mouseleave',function(){

limitations and requirements

  • jQuery 1.3.2
  • Currently there is no way to clear the timeout