【问题标题】:Js animation does not workjs动画不起作用
【发布时间】:2018-09-27 12:57:46
【问题描述】:

Js 动画字母不起作用。

Console :index.php:29 Uncaught ReferenceError: $ is not defined at 索引.php:29。没有动画的黑色字母。

$('.ml11 .letters').each(function(){
    $(this).html($(this).text().replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>"));
});

anime.timeline({loop: true})
    .add({
        targets: '.ml11 .line',
        scaleY: [0,1],
        opacity: [0.5,1],
        easing: "easeOutExpo",
        duration: 700
    })
    .add({
        targets: '.ml11 .line',
        translateX: [0,$(".ml11 .letters").width()],
        easing: "easeOutExpo",
        duration: 700,
        delay: 100
    }).add({
    targets: '.ml11 .letter',
    opacity: [0,1],
    easing: "easeOutExpo",
    duration: 600,
    offset: '-=775',
    delay: function(el, i) {
        return 34 * (i+1)
    }
}).add({
    targets: '.ml11',
    opacity: 0,
    duration: 1000,
    easing: "easeOutExpo",
    delay: 1000
});

【问题讨论】:

  • 您是否已将 jquery 添加到您的解决方案中?你可以在这里得到它:w3schools.com/jquery/jquery_get_started.asp
  • 好像你还没有加载 jQuery
  • @Patte 可能不是因为这个问题甚至没有用 jQuery 标记;)
  • 是的,正在工作。谢谢

标签: javascript jquery animation letters


【解决方案1】:

jQuery 是解决方案:https://www.w3schools.com/jquery/jquery_get_started.asp.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

【讨论】:

    猜你喜欢
    • 2013-07-11
    • 2018-09-13
    • 1970-01-01
    • 2021-10-25
    • 1970-01-01
    • 2015-12-27
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    相关资源
    最近更新 更多