Swiper4的基本使用
基本介绍:
- 中文文档地址:https://www.swiper.com.cn/
- 它是一个开源,免费,强大的触摸滑动插件。
- 它是用纯Javascript打造的滑动特效插件,既可用于PC端,也可用于移动端设备。
基本使用:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>独秀不爱秀</title>
<link rel="stylesheet" type="text/css" href="swiper/css/swiper.css">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.swiper-container {
width: 1000px;
height: 500px;
margin: 100px auto;
background-color: green;
}
.swiper-slide {
font-size: 30px;
text-align: center;
line-height: 500px;
color: #fff;
}
</style>
</head>
<body>
<div class="swiper-container">
<ul class="swiper-wrapper">
<li class="swiper-slide">1111</li>
<li class="swiper-slide">2222</li>
<li class="swiper-slide">3333</li>
<li class="swiper-slide">4444</li>
<li class="swiper-slide">5555</li>
<li class="swiper-slide">6666</li>
<li class="swiper-slide">7777</li>
</ul>
<!-- 分页器 -->
<div class="swiper-pagination"></div> <!-- 导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script src="swiper/js/swiper.js"></script>
<script type="text/javascript">
// 初始化Swiper
var mySwiper = new Swiper('.swiper-container', {
// 循环轮播
loop: true,
// 分页器
pagination: {
el: '.swiper-pagination', // 动态分页器:当你的slide很多时,为true后,分页器会有大小显示
dynamicBullets: true,
},
// 前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// 自动轮播
autoplay: {
delay: 3000,
/**
* stopOnLastSlide => true: 当切换到最后一个slide时停止自动切换
*/
stopOnLastSlide: true,
/**
* disableOnInteraction:用户操作swiper之后,是否禁止自动轮播
* true(默认) => 停止
* false => 恢复自动轮播
*/
disableOnInteraction: false,
}
});
</script>
</body>
</html>
效果展示:

其他额外参数请参考中文文档。
Swiper4的基本使用的更多相关文章
- Swiper4.x使用方法
1.首先加载插件,需要用到的文件有swiper.min.js和swiper.min.css文件.可下载Swiper文件或使用CDN. <!DOCTYPE html> <html> ...
- 记录一下对swiper4.x.js在H5单页中的滑动优化
应用场景 仅仅应用于单页应用的滑动操作,用swiper4.x接管页面的滚动操作.用来支持顶部和尾部的回弹效果,进一步来支持常见那种下拉刷新动画效果.不适用于轮播图那种应用场景. 虽然只是针对swipe ...
- swiper4自动轮播切换手动触碰后停止踩坑——属性disableOnInteraction
swiper4轮播设置autoplay自动切换后,即默认设置: <script> var mySwiper = new Swiper('.swiper-container', { auto ...
- Vue 使用swiper4导致ie或手机浏览器打开空白的问题
from:https://segmentfault.com/a/1190000015831092 在ie下发现就是swiper的不兼容,一加上去ie就不显示了.结果是swiper版本的问题,最新的sw ...
- vue-cli使用swiper4在ie以及safari报错
vue-cli项目中,通过npm run swiper --save-dev安装的是swiper4版本的插件,这样安装以后在谷歌火狐等浏览器都可以正常运行,但是在safari浏览器(可能是版本太低)还 ...
- swiper4实现的拥有header和footer的全屏滚动demo/swiper fullpage footer
用swiper4实现的拥有header和footer的全屏滚动demo, <!DOCTYPE html> <html lang="en"> <head ...
- 在vue中使用swiper4.x
需求 :实现一个左右两边有边距的轮播图vue+swiper4 轮播图左右两边含有上一张和下一张的一部分 先安装swiper: 1.npm install swiper 安装swiper 2.在入口 ...
- swiper4 一个页面多个轮播
<div class="swiper-container"> <div class="swiper-wrapper"> <div ...
- swiper4初始化/swiper-init/data-swiper
用data属性初始化swiper <!DOCTYPE html> <html lang="en"> <head> <meta charse ...
- swiper4基础
这段时间在公司实习做前端,感觉前端没学习到很多前端框架,接口那些都是写好的,只需要调用就好,感觉没什么好记的,唯一觉得有必要记的就是swiper轮播了,在前端做网站的时候经常用到swiper做公告,图 ...
随机推荐
- Error-ASP.NET:此 SqlTransaction 已完成;它再也无法使用。
ylbtech-Error-ASP.NET:此 SqlTransaction 已完成:它再也无法使用. 1.返回顶部 1. “/”应用程序中的服务器错误. 此 SqlTransaction 已完成: ...
- odoo开发笔记 -- 还原数据库后,异常:ir_attachment: IOError: [Errno 2] No such file or directory: u'/var/...'
场景描述: 恢复Odoo数据后,抛出错误导致无法进入页面 -- ::, INFO aeo odoo.addons.base.ir.ir_attachment: _read_file reading / ...
- 2019 GDD TensorFlow
https://www.tensorflow.org/ https://tensorflow.google.cn/ (中文站点) 现场PPT照片: https://pan.baidu.c ...
- SDN实验---Ryu的应用开发(四)基于跳数的最短路径转发原理
一:实现最短跳数转发 (一)原理 推文:迪杰斯特拉算法和弗洛伊德算法 二:代码实现 (一)全部代码 from ryu.base import app_manager from ryu.controll ...
- 【翻译】Flink Table Api & SQL — 流概念
本文翻译自官网:Streaming Concepts https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/table/st ...
- 【嵌入式开发】裸机引导操作系统和ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 )
[嵌入式开发]ARM 内存操作 ( DRAM SRAM 类型 简介 | Logical Bank | 内存地址空间介绍 | 内存芯片连接方式 | 内存初始化 | 汇编代码示例 ) 一. 内存 ...
- 1-1docker加速器
配置加速器 #编译配置 sudo vim /etc/docker/daemon.json #加入下面的数据 { "registry-mirrors": ["https:/ ...
- Node.js实现PC端类微信聊天软件(四)
Github StackChat 学习回顾 React和Electron结合 TypeError: fs.existsSync is not a function 在React组件里引入electro ...
- QT源码分析:QObject
QT框架里面最大的特色就是在C++的基础上增加了元对象系统(Meta-Object System),而元对象系统里面最重要的内容就是信号与槽机制,这个机制是在C++语法的基础上实现的,使用了函数.函数 ...
- socket-02
# -- coding: utf-8 -- _author__ = "HuaQiang Yan" import socket def handle_request(client): ...