1、先链接css和js文件

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

2、初始化

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

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

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

  自定义的动画效果:

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

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

  css中定义效果

@-webkit-keyframes shutter2{
from{top: 100%;}
to{top:;}
}
.shutter2{
-webkit-animation: shutter2 0.5s forwards;
animation: shutter2 0.5s forwards;
}

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. HDU 4498 Function Curve (分段, simpson)

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 最近太逗了...感觉成都要打铁了...只能给队友端 ...

  2. linux之sed

    sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以将数据行进行替换.删除.新增.选取等特定工作,下面先了解一下sed的用法sed命令行格式为:         sed ...

  3. es5 api

    ES5 Object.create(prototype, descriptors) //创建对象 var o1 = {foo:'bar'}; var o2 = new Object(); //Obje ...

  4. 老男孩python第六期

    01 python s6 day7 上节回顾02 python s6 day7 SNMP使用03 python s6 day7 大型监控架构讲解04 python s6 day7 Redis使用05 ...

  5. HDU 1002 A + B Problem II(大整数相加)

    A + B Problem II Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u De ...

  6. UIImageView图片视图的基本概念和使用方法

    IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法(博客地址: http://blog.csdn.net/developer_jiangqq ) Author:hmjiangqq ...

  7. sql 查询所有数据库、表名、表字段总结

    ms sql server 1.查询所有表select [id], [name] from [sysobjects] where [type] = 'u' order by [name]2.查询所有数 ...

  8. java 錯誤集錦.

    (1)加载驱动成功com.microsoft.sqlserver.jdbc.SQLServerException: 不支持此服务器版本.目标服务器必须是 SQL Server 2000 或更高版本.链 ...

  9. JS图表组件 highcharts 简单的介绍

    把highcharts拿来做个简单的介绍,希望更多的朋友可以用到这个用来做图表的js插件. preparation Highcharts Highcharts是一个制作图表的纯Javascript类库 ...

  10. strstr 的使用

    Problem E: Automatic Editing Source file: autoedit.{c, cpp, java, pas} Input file: autoedit.in Outpu ...