Как настроить speed.js?
Я хотел бы знать, как мы можем включить в наш проект библиотеку speed.js, чтобы у нас была более плавная анимация. Спасибо!
index.html
<div class="demo-content">
<div class="box" id="with-jquery">jQuery</div>
<a href="#" class="play" id="play-jquery"><span class="ion ion-play">
</span>Play</a>
<div class="box" id="with-velocity">Velocity.js</div>
<a href="#" class="play" id="play-velocity">
<span class="ion ion-play"></span>Play</a>
</div>
script.js
function withAnimate() {
$("#with-jquery").animate({
left: "500px",
}, {
duration: 3000,
easing: "linear"
} );
}
$("#play-jquery").on('click', function(){
withAnimate();
});
function withVelocity() {
$("#with-velocity").velocity({
left: "500px",
}, {
duration: 3000,
easing: "linear"
} );
}
$("#play-velocity").on('click', function(){
withVelocity();
});
1 ответ
Вам нужно включить speed.js перед speed.ui.js
speed.js - это базовая библиотека, а speed.ui.js - набор анимаций.
Я просто разветвляю ваш jsbin для рабочего образца