我可以将delay(500)放在addClass()之前吗? [英] Can I put delay(500) before an addClass()?

查看:85
本文介绍了我可以将delay(500)放在addClass()之前吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

在单击它时不会延迟.我想要完成的.为什么可以并且有可能克服这种漏洞?谢谢!

This does not put an delay on it when it gets clicked. Which I want to accomplish. Why and is this hackable, possible to overcome? Thanks!

推荐答案

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

delay only works with animating methods, you can use setTimeout function:

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

这篇关于我可以将delay(500)放在addClass()之前吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆