我想知道我们如何将velocity.js 库包含到我们的项目中,以便我们可以拥有更流畅的动画。谢谢!
索引.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>
脚本.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();
});