【发布时间】: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