【问题标题】:add a delay to javascript fadeIn effect? [duplicate]为javascript淡入淡出效果添加延迟? [复制]
【发布时间】:2012-12-17 17:04:10
【问题描述】:

可能重复:
delay JQuery effects

有谁知道我如何在这个脚本中添加大约 1 秒的时间延迟?

我希望在 modcontentplatinum 淡出后大约一秒钟后,fadesIn 的 modcontentplatinummore div 淡入。

谢谢。

<script>
$(".modcontentplatinummore").hide();
$('.morebutton-platinum').click(function () {
    if ($('.modcontentplatinummore').is(":hidden")) {       
        $('.modcontentplatinum').fadeOut(500);
        $('.modcontentplatinummore').fadeIn(500);
    } else {
        $('.modcontentplatinummore').fadeOut(500);
        $('.modcontentplatinum').fadeIn(500);
    }
});
</script>

【问题讨论】:

  • @Diodeus: +1,虽然这个问题有利于过时的 jQuery 版本(1.4 之前)的答案:-/
  • zzz 你看过 jQuery 文档吗?

标签: javascript jquery


【解决方案1】:

只需使用delay method 即可为动画队列添加超时。

【讨论】:

    【解决方案2】:

    我们可以使用 jquery 中的 delay() 添加延迟,请使用此链接http://api.jquery.com/delay/

    【讨论】:

      猜你喜欢
      • 2018-06-03
      • 2012-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-10
      • 2017-02-12
      • 1970-01-01
      • 2013-08-31
      相关资源
      最近更新 更多