use*_*217 23 jquery addclass delay
$(document).ready(function(){
$("#info-text-container").click(function(){
$("#info-text").delay(500).addClass("info-text-active");
});
});
Run Code Online (Sandbox Code Playgroud)
单击它时不会对其造成延迟.我想要完成的.为什么这个可以克服,可以克服?谢谢!
und*_*ned 40
delay
只适用于动画方法,你可以使用setTimeout
函数:
$("#info-text-container").click(function(){
setTimeout(function(){
$("#info-text").addClass("info-text-active");
}, 500);
});
Run Code Online (Sandbox Code Playgroud)
elc*_*nrs 38
不太像那样,但是像这样:
$("#info-text").delay(500).queue(function(next) {
$(this).addClass("info-text-active");
next();
});
Run Code Online (Sandbox Code Playgroud)