Hi,

I just had a quick question. I'm trying to add a new set of effects
functions to jquery (that I hope to release as a plugin), but for some
reason I can't get them to work, despite returning the correct element
from all my functions.

Basically, i have extended the core with a .delay function which takes
a delay and a callback, I'm then using this function within my effects
functions to simulate a delay. My delay function is as follows:

        jQuery.extend({
          delay: function( delay, callback ) {
                  var _this = this;
                  var p = $('<div>');
                  p.animate({left : 100 }, delay, callback);
                  //return this;
          }
        });

and one of the fade functions is as so:

        (function($)
        {
          $.fn.delayFadeOut = function(delay, speed, callback){
                  var _this = this;
                  $.delay(delay, function() {
                        return _this.fadeOut(speed, function() {
                                if(typeof(callback) == 'function') {
                                        callback();
                                }
                        });
                  });
          }
        })(jQuery);

Now, it works perfectly if I do a single fade, wbut when I try to
chain a few fades together it seems to break, like this:

$('#fade').delayFadeOut(2000, 1000).fadeIn(1000);

The effect should be, pause for 2 seconds, fade out for 1 second, then
fade in straight away for 1 second.

jQuery returns the following error to me:

$("#fade").delayFadeOut(2000, 1000) has no properties


Is there something I'm doing wrong? As far as I can see I'm returning
the correct nodes etc.


Any help would be greatly appreciated.

Thanks,
Ben.

Reply via email to