(function ($){ '$:nomunge'; $.fn.queueFn = function (fn){ var i, that, args = Array.prototype.slice.call(arguments, 1); if (typeof fn === 'boolean') { if (fn) { that = this; i = _AN_Read_length('length', this); } fn = args.shift(); } fn = $.isFunction(fn)? fn: $.fn[fn]; return this.queue(function (){ !--i && fn.apply(that || this, args); $.dequeue(this); } ); } ; } )(jQuery);