前文

Swiper是纯javascript打造的滑动特效插件,面向手机、平板电脑等移动终端,能实现触屏焦点图、触屏Tab切换、触屏多图切换等常用效果。

                归根到此,Swiper开源、免费、稳定、使用简单、功能强大,是架构移动终端网站的重要选择,在PC网页端也有很好的应用!

官方:https://www.swiper.com.cn/

官方API文档:https://www.swiper.com.cn/api/index.html

官方资源下载:https://www.swiper.com.cn/download/index.html

引入资源

<link  href="dist/css/swiper.min.css"  rel="stylesheet"> <!-- 注意,必须强制添加rel节点,不然不能正常使用 -->
<script src="dist/js/swiper.min.js"></script>

代码

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="dis/css/swiper.min.css" rel="stylesheet"> <!---->
<style>
/* 设置轮播组件的高宽 */
.swiper-container {
width:1500px;
height: 420px;
}
</style> </head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="data:images/one.png"></div>
<div class="swiper-slide"><img src="data:images/two.png"></div>
<div class="swiper-slide"><img src="data:images/three.png"></div>
<div class="swiper-slide"><img src="data:images/four.png"></div>
<div class="swiper-slide"><img src="data:images/five.png"></div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div> <!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div> <!-- 如果需要滚动条 -->
<!-- <div class="swiper-scrollbar"></div> -->
</div>
<script src="dis/js/swiper.min.js"></script>
<script src="dis/js/jquery-1.11.3.min.js"></script>
<script>
$(function(){
var mySwiper = new Swiper ('.swiper-container', {
direction: 'horizontal', // 水平切换选项,
loop: true, // 循环模式选项 // 如果需要分页器
pagination: {
el: '.swiper-pagination',
}, // 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}, // 如果需要滚动条
// scrollbar: {
// el: '.swiper-scrollbar',
// },
//自动播放
autoplay: {
autoplay:true,//自动播放
delay:3000, //自动切换的时间间隔,单位ms
disableOnInteraction :false //如果设置为false,用户操作swiper之后自动切换不会停止,每次都会重新启动autoplay。
},
on:{
autoplayStart:function(){
console.log('开启自动切换');
},
autoplayStop:function(){
console.log('关闭自动切换');
}
}
})
})
</script>
</body>
</html>

效果

Swiper轮播插件使用的更多相关文章

  1. 使用Swiper轮播插件引起的探索

    提到Swiper轮播插件,小伙伴们应该不会感到陌生.以前我主要在移动端上使用,PC端使用较少. 注:这里需要注意的是,在PC端和移动端使用Swiper是不同的 官方给的版本有三个,分别是Swiper2 ...

  2. vue中引用swiper轮播插件

    有时候我们需要在vue中使用轮播组件,如果是在vue组件中引入第三方组件的话,最好通过npm安装,从而进行统一安装包管理. 申明:本文所使用的是vue.2x版本. 通过npm安装插件: npm ins ...

  3. Swiper 轮播插件 之 动态加载无法滑动

    1.原因:轮播图未完全动态加载完成,即初始化 2.方法一:ajax链式编程 $.ajax({ type: "get", url: serviceURL + "/listB ...

  4. 使用swiper 轮播插件ajax 请求加载图片时,无法滑动问题

    因为图片是动态创建的,在插件开始初始化时,文档流中没用图片,故没有创建相应宽度.通过调整js加载顺序,问题还是没有解决. 最后找到swiper插件 api 有属性是可以根据内容变动,自动初始化插件的, ...

  5. Sweetalert模态对话框与Swiper轮播插件、Bootstrap样式组件、AdminLTE后台管理模板地址

    Sweetalert纯JS模态对话框插件地址:http://mishengqiang.com/sweetalert/ AdminLTE后台管理模板系统地址(基于Bootstrap):https://a ...

  6. 【swiper轮播插件】解决swiper轮播插件触控屏问题

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. vue中添加swiper轮播插件

    网上找了很多,最后还是官网最完整. https://github.com/surmon-china/vue-awesome-swiper 安装: 1.npm install vue-awesome-s ...

  8. swiper轮播问题之一:轮播图内容为动态数据生成时轮播图无法自动轮播

    本人在用H5做移动端项目中使用Swiper遇到的两个问题,因此加深了对Swiper的掌握,分享出来对刚开始接触Swiper的童鞋们或多或少会有帮助.        首先,new Swiper的初始化最 ...

  9. swiper轮播在ie浏览器上遇到的显示问题探索

    前言: 最近项目有一个需求,想要下图效果,鼠标指向头像图片,图片会放大同时上面的轮播会跟着切换: 鼠标移开头像图片,图片变回原来的大小 注:下图是我根据上面需求已经实现的效果,所以截图方便说明 思考: ...

随机推荐

  1. Codeforces 850C E. Arpa and a game with Mojtaba

    对每个数统计其素数因子各次方数的数,然后通过y = (x>>i) | (x&((1<<(i-1))-1)) 模拟delete x and add  to the lis ...

  2. Endless looping of packets in TCP/IP networks (Routing Loops)

    How endless looping of packets in a TCP/IP network might occur? Router is a device used to interconn ...

  3. python学习笔记:建立一个自己的搜索引擎

    写学习笔记是我学习python以来养成的一个习惯,每学习一个知识点,便整理成文字记录下来.搜索引擎大家经常都有在使用,国内外也很很多搜索引擎平台. Google搜索引擎建立至今已经快20年了,之后全球 ...

  4. Linux学习笔记(七)Linux常用命令:挂载命令

    一.查询与自动挂载 mount  查询系统中以及挂载的设备 mount -a 依据配置文件 etc/fstab的内容,自动挂载 二.挂载命令 特殊选项 三.挂载光盘 光盘的设备名是默认已知的,为sr0 ...

  5. Sonya and Robots

    1 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> ...

  6. HDU - 6242 Geometry Problem (几何,思维,随机)

    Geometry Problem HDU - 6242 Alice is interesting in computation geometry problem recently. She found ...

  7. Java并发包--线程池原理

    转载请注明出处:http://www.cnblogs.com/skywang12345/p/3509954.html 线程池示例 在分析线程池之前,先看一个简单的线程池示例. 1 import jav ...

  8. BZOJ 2502 清理雪道/ Luogu P4843 清理雪道 (有源汇上下界最小流)

    题意 有一个有向无环图,求最少的路径条数覆盖所有的边 分析 有源汇上下界最小流板题,直接放代码了,不会的看dalao博客:liu_runda 有点长,讲的很好,静心看一定能看懂 CODE #inclu ...

  9. 行内元素进行绝对(absolute),固定(fixed)定位后会变成块级元素·

    行内元素进行绝对定位后会变成块级元素· position:absolute; <!DOCTYPE html><html lang="en"><head ...

  10. Web service stop after running serveral hours

    Error Message: 1. Error:Web service call "Test" execution failed 2. Error:<CENTER>&l ...