1、先链接css和js文件

  1. <link rel="stylesheet" type="text/css" href="css/swiper-3.3.1.min.css"/>
  2. <link rel="stylesheet" type="text/css" href="css/animate.min.css"/>
  3.  
  4. <script type="text/javascript" src="js/swiper-3.3.1.min.js"></script>
  5. <script type="text/javascript" src="js/swiper.animate1.0.2.min.js"></script>

2、初始化

  1. /* 初始化swiper.js */
  2. var mySwiper = new Swiper('.swiper-container',{
  3. pagination : '.swiper-pagination', //分页器
  4. direction:'vertical', //垂直方向换页
  5. slideToClickedSlide: true, //slide1向slide2 swipe的过程中轻点slide1会回到slide1
  6.  
  7. /* 初始化animate */
  8. onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit
  9. swiperAnimateCache(swiper); //隐藏动画元素
  10. setTimeout(function(){ //2s后开始运行动画(移动端总是没加载完图片就开始动画了。。。。。)
  11. swiperAnimate(swiper); //初始化完成开始动画
  12. },2000)
  13. },
  14. onSlideChangeEnd: function(swiper){
  15. swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
  16. }
  17. })

4、使用animate的动画,注意class中要加“ani”

  1. <img class="ani pic" src="pic.jpg" swiper-animate-effect="zoomIn" swiper-animate-duration="0.7s" />

  自定义的动画效果:

  html中添加class=“ani” 和swiper-animate-effect=“动画名”,可以与animate自带的动画一样,在每次切换时运行动画。

  1. <img class="ani pic" src="pic.jpg" swiper-animate-effect="shutter2" />

  css中定义效果

  1. @-webkit-keyframes shutter2{
  2. from{top: 100%;}
  3. to{top:;}
  4. }
  5. .shutter2{
  6. -webkit-animation: shutter2 0.5s forwards;
  7. animation: shutter2 0.5s forwards;
  8. }

API地址: http://www.swiper.com.cn/api/start/2014/1218/140.html

swiper,animate使用方法的更多相关文章

  1. Swiper教程 —— 使用方法

    Swiper使用方法 1.首先加载插件,需要用到的文件有swiper.min.js和swiper.min.css文件. <!DOCTYPE html> <html> <h ...

  2. 微信网页动画---swiper.animate.css

    项目需要,自己写了个demo <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  3. jQuery中animate()的方法以及$(&quot;body&quot;).animate({&quot;scrollTop&quot;:top})不被Firefox支持问题的解决

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/50846678 本文出自[我是干勾鱼的博客] jQuery中animate()的方 ...

  4. 使用swiper.animate时,给一个对象添加两个动画且动画循环的方法

    swiper官网上给对象加一个动画的方法是 <div class="swiper-slide"> <p class="ani" swiper- ...

  5. swiper.animate~之~可以执行两种动画的升级版的Swiper Animate

        1.下载插件swiper.animate-twice.min.js,加载进页面. <!DOCTYPE html> <html> <head> ... < ...

  6. Swiper.js使用方法

    <!DOCTYPE html> <html> <head>  ... <link rel="stylesheet" href=" ...

  7. js文件中模块化导入swiper.js文件方法

    es6导入: 在js文件顶端 import Swiper from "../../assets/javascripts/swiper.min"; import '../../ass ...

  8. animate使用方法

    链接:https://www.cnblogs.com/xiaohuochai/p/7372665.html

  9. css常用效果总结

    1.给input的placeholder设置颜色 .phColor::-webkit-input-placeholder { /* WebKit, Blink, Edge */ color:maroo ...

随机推荐

  1. hadoop搭建杂记:Linux下JDK环境变量的设置(三种配置环境变量的方法)

    Linux下JDK环境变量的设置(三种配置环境变量的方法) Linux下JDK环境变量的设置(三种配置环境变量的方法) ①修改/etc/profile文件 如果你的计算机仅仅作为开发使用时推荐使用这种 ...

  2. 通过springmvc的RequestMapping的headers属性的使用

    直接上图: springmvc中可以通过@RequestMapping注解折配置headers属性,也就是通过headers属性来配置请求头信息,从而通过这个属性值来映射请求,因为不同浏览器的Acce ...

  3. [转]WIN7系统安装Apache 提示msvcr110.DLL

    我的系统是WIN7 64位,安装配置Apache2.4.7(httpd-2.4.7-win64-VC11.zip )提示如下错误 VC++2012 2013 百度网盘地址:http://pan.bai ...

  4. 四轴飞行器1.7 NRF24L01P无线通讯和改进型环形缓冲

    原创文章,欢迎转载,转载请注明出处 这次花了10多天了才再次写blog,一是中秋优点小活动,二是这次完成了不少东西.. 终于接近完成了,这次完成了NRF的通讯,并且用了改进的环形缓冲和简单的通讯协议规 ...

  5. Angular ng-repeat 对象和数组遍历

    直接上代码 <!DOCTYPE html> <html> <head> <meta name="description" content= ...

  6. 删除windows7保留分区

    在系统里以管理员运行CMD.exe键入diskpartsel disk 0  (select 选择硬盘)list vol  (查看卷)sel vol 0  (选择卷,0为保留分区)inactive ( ...

  7. PADS Layout怎样放置间距一样的同一种元件

    少数元件的话,栅格设置是最好的,即将栅格设置成你要放置元件的间距,然后逐个移动元件放置.如果元件几十上百个,这样做就累死人了,此时就得设置阵列.按顺序选择你要放置的元件-右键-create arry, ...

  8. 向前辈致敬 strspn

    把8位的CHAR型数据分解为:前5位和后3位,这样2^5 = 32个CHAR型数+值就可表示所有的CHAR型数据 这样做的好处:在给出子串后,不用比较256次,最多比较32次即可判断出是否一个数在子串 ...

  9. iOS 中 Touch ID得使用方法

    iPhone 5S公布以后,iOS设备基本都有集成Touch ID.而这个功能对自己的App也是一个非常好的扩展,关于Touch ID的使用方法.大致例如以下, Swift: 引入LocalAuthe ...

  10. c# 遍历文件夹及其所有文件

    利用VS创建一个winform应用程序,遍历指定文件夹(photos)内的所有文件夹及其文件.具体程序如下: namespace 遍历文件夹及其所有文件 { public partial class ...