gpt4 book ai didi

jquery - 我可以将delay(500)放在addClass()之前吗?

转载 作者:行者123 更新时间:2023-12-03 21:39:38 25 4
gpt4 key购买 nike

$(document).ready(function(){
$("#info-text-container").click(function(){
$("#info-text").delay(500).addClass("info-text-active");
});
});

这不会在点击时造成延迟。我想实现这一点。为什么会出现这种情况?这是否可以被破解?谢谢!

最佳答案

delay 仅适用于动画方法,您可以使用 setTimeout 函数:

$("#info-text-container").click(function(){
setTimeout(function(){
$("#info-text").addClass("info-text-active");
}, 500);
});

关于jquery - 我可以将delay(500)放在addClass()之前吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15448344/

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