开发者

`delay` is not a function (jQuery 1.3)

开发者 https://www.devze.com 2023-02-18 15:15 出处:网络
This is the error i\'m getting from Firebug using jQuery in a function outside (and before) the $(document).ready because it is used in a inline onclick event:

This is the error i'm getting from Firebug using jQuery in a function outside (and before) the $(document).ready because it is used in a inline onclick event:

$("#_box").fadeIn(500).delay is not a function
$('#_box').fadeIn(500).delay(3000).fadeOut(500);

and this is the function:

function throwBox(message) {
    $('#_box').html(message);
    $('开发者_高级运维#_box').fadeIn(500).delay(3000).fadeOut(500);
}

Isn't delay() a jQuery function? What happens in my browser is that the fadeIn() function is called nicely and the box appear, but then stands there and doesn't disappear.


I loaded an old copy of jQuery (1.3) instead of the new one while delay() was added in version 1.4 as suggested by Quintin Robinson.


If you're stuck using jQuery 1.3 (maybe you're working with Drupal 6) a work-around is to animate a property that's constant.

For example, replace:

$("#id").delay(1000).fadeOut();

With:

$("#id").animate({top: 0}, 1000).fadeOut();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号