gpt4 book ai didi

jQuery 延迟不起作用

转载 作者:行者123 更新时间:2023-12-01 08:21:42 25 4
gpt4 key购买 nike

Possible Duplicate:
jQuery: Can I call delay() between addClass() and such?

您好,我有一个问题。

下面的 jQuery 代码对我不起作用..

$("#message").addClass("highlightError").delay(15000).removeClass("highlightError");

错误是什么?

甚至没有添加该类..我用Firebug检查过,没有显示错误..

请帮忙

谢谢!|

最佳答案

removeClass 不被效果队列使用,因此延迟对其没有影响。要使其在效果队列中被调用,请使用 queue() 手动添加它。 :

$(function(){
$("#message").addClass("highlightError").delay(2000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
});

在这里工作:http://jsfiddle.net/QkpJn/1

关于jQuery 延迟不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6976475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com