【问题标题】:FadeIn() alert-error not working in bootstrap3FadeIn() 警报错误在 bootstrap3 中不起作用
【发布时间】:2013-08-19 04:41:04
【问题描述】:

尝试使用引导程序 3 警报错误和隐藏类将消息淡入到 div,但它不起作用。使用 bootstrap 2.3.2 也是一样的,是否还有其他方法可以用于 bootstrap 3。

HTML:

<div id="success" class="alert alert-success hide"></div><br>
<button type="submit" id="click" >Click</button>

JavaScript:

$("#click").click(function() {
    $("#success").html('Hello World!').fadeIn();
});

Bootstrap3 小提琴:http://jsfiddle.net/MLpyH/

Bootstrap2.3.2 小提琴:http://jsfiddle.net/e4SAK/

【问题讨论】:

    标签: javascript jquery css twitter-bootstrap-3


    【解决方案1】:
    $("#success").html('Hello World!').removeClass("hide").hide().fadeIn("slow");
    

    http://jsfiddle.net/MLpyH/11/

    【讨论】:

    • @AvinVarghese 现在试试
    • 用于显示 div?有slideDown,你可以使用animate并改变不透明度
    • 嗯,这是该课程的主要目的毕竟隐藏:)!
    【解决方案2】:

    从 Bootstrap 3.0.1 开始,类 .hidedeprecated 并替换为 .hidden.sr-only

    <div id="success" class="alert alert-success hidden"></div>
    

    通过 rps 更新答案:

    $("#success").html('Hello World!').removeClass("hidden").hide().fadeIn("slow");
    

    (我不想写一个全新的答案,但我不允许发表评论。无论如何,谢谢你,rps)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-13
      • 2014-11-18
      • 2015-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多