javascript - `delay` is not a function (jQuery 1.3) - Stack Overflow

This is the error i'm getting from Firebug using jQuery in a function outside (and before) the $(d

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.

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.

Share edited Mar 17, 2011 at 18:33 user166390 asked Mar 17, 2011 at 18:10 ShoeShoe 76.3k38 gold badges176 silver badges278 bronze badges 2
  • 2 Which version of jQuery? – Dogbert Commented Mar 17, 2011 at 18:12
  • 4 What version of jQuery are you using?.. delay() was added in 1.4 api.jquery./delay – Quintin Robinson Commented Mar 17, 2011 at 18:12
Add a ment  | 

2 Answers 2

Reset to default 6

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();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743772535a4504633.html

相关推荐

  • javascript - `delay` is not a function (jQuery 1.3) - Stack Overflow

    This is the error i'm getting from Firebug using jQuery in a function outside (and before) the $(d

    7天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信