
jquery.animator.js 是一款基于 animate.css 的 jquery 动画插件。Animator 插件可以为 DOM 元素提供各种 animate.css 中设定的 CSS3 动画,并额外提供当 DOM 元素进入视口时触发 CSS3 动画的方法。
在页面中引入 jquery 和 jquery.animator-beta.min.js 文件,以及 animate.css 样式文件。
<link href="path/to/css/animate.css" rel="stylesheet">
<script src="path/to/js/jquery.min.js"></script>
<script src="path/to/js/jquery.animator-beta.min.js"></script>
要为一个目标 DOM 元素设置动画效果,可以简单的使用下面的 jquery 代码。
$('#target-elem').addAnimation('lightSpeedIn',500);
其中 lightSpeedIn 是 animate.css 中设定的 CSS3 动画名称。如果需要在元素进入视口时,触发指定的 CSS3 动画,可以使用下面的代码:
if($('#target-elem').isOnScreen()){
$('#target-elem').addAnimation('lightSpeedIn');
}
你也可以将 DOM 元素上指定的动画移除:
$('#ele').removeAnimation('lightSpeedIn');
jquery.animator.js-jquery 动画插件的 github 地址为:https://github.com/zugoripls/jquery.animator
演示地址 | 下载地址 |
专业提供WordPress主题安装、深度汉化、加速优化等各类网站建设服务,详询在线客服!