【问题标题】:fade in effect jquery with delay and css animations带有延迟和 css 动画的淡入效果 jquery
【发布时间】:2014-09-16 02:37:36
【问题描述】:

我正在尝试做这样的事情:

    $('#list-item-1').delay(500).addClass('animated fadeInRight');
    $('#list-item-2').delay(1000).addClass('animated fadeInRight');
    $('#list-item-3').delay(1500).addClass('animated fadeInRight');
    $('#list-item-4').delay(2000).addClass('animated fadeInRight');
    $('#list-item-5').delay(2500).addClass('animated fadeInRight');
    $('#list-item-6').delay(3000).addClass('animated fadeInRight');

但所有项目同时从右侧淡入。我不明白为什么

【问题讨论】:

  • 您可能想为动画和fadeInRight 类添加css

标签: jquery css animation delay fade


【解决方案1】:

delay()addClass() 没有影响,您应该使用setTimeout

示例

setTimeout(function(){$('#list-item-1').addClass('animated fadeInRight');}, 500);

【讨论】:

  • 您忘记了 $ 符号。不过非常感谢,现在完美了
【解决方案2】:

delay() 仅适用于效果队列。 addClass() 不是效果队列。您需要使用 slideUp() 之类的东西来让延迟像这样工作。

【讨论】:

    【解决方案3】:

    尝试使用 setTimeout 函数。

    https://www.udemy.com/blog/jquery-settimeout/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 2021-04-11
      • 2021-07-29
      • 1970-01-01
      相关资源
      最近更新 更多