swiper tabs综合示例

html部分:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" /> <title>3-1 tab切换综合示例</title>
<link rel="stylesheet" type="text/css" href="js/swiper/idangerous.swiper2.7.6.css" />
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide bg-1png"></div>
<div class="swiper-slide bg-2png"></div>
<div class="swiper-slide bg-3png"></div>
<div class="swiper-slide bg-4png"></div>
</div>
</div> <div class="tabs">
<a href="" class="active">首页</a>
<a href="">课程</a>
<a href="">发现</a>
<a href="">我的</a>
</div> <script type="text/javascript" src="js/jquery/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="js/swiper/idangerous.swiper2.7.6.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
CSS:
@charset "utf-8";
*{
margin: 0;
padding: 0;
}
html,body{
width: 100%;
height: 100%;
}
.swiper-container,
.swiper-wrapper,
.swiper-slide{
width:100%;
height: 100%;
}
.bg-red{
background: darkred;
}
.bg-blue{
background: royalblue;
}
.bg-green{
background: darkgreen;
}
.bg-1png{
background: url(../image/001.png);
background-size: cover;
}
.bg-2png{
background: url(../image/002.png);
background-size: cover;
}
.bg-3png{
background: url(../image/003.png);
background-size: cover;
}
.bg-4png{
background: url(../image/004.png);
background-size: cover;
}
.tabs{
position: fixed;
left: 0;
bottom: 0;
height: 45px;
line-height: 45px;
background: white;
color: black;
z-index: 999;
width: 100%;
border-top: 1px solid #ddd;
}
.tabs a{
display: inline-block;
width: 23%;
text-align: center;
font-size: 14px;
color: #333;
text-decoration: none;
}
.tabs a.active{
color: #e40;
background: #ddd;
}
.swiper-scrollbar{
position: absolute;
bottom: 5px;
left: 0;
width: 100%;
height: 10px;
background: #fff;
z-index: 999;
}
JS:
// demo1 垂直滚动
/* var swiper = new Swiper('.swiper-container',{
mode:'vertical'
}); */ //demo2 progress插件
/* var swiper = new Swiper('.swiper-container',{
progress:true,
onProgressChange:function(swiper){
//获取每个slide的progress属性,并设定其现在角度以及旋转后角度
//例如当前活动slide是0,向左拖动则变成1,进行360度旋转,向右拖动则变成-1,进行-360度旋转
for(var i=0;i<swiper.slides.length;i++){
var slide = swiper.slides[i];
var progress = slide.progress;
swiper.setTransform(slide,'rotate('+ 360*progress +'deg)');
}
},
onSetWrapperTransition:function(swiper,speed){
for(var i=0;i<swiper.slides.length;i++){
swiper.setTransition(swiper.slides[i],speed);
}
}
}); */ //demo3 3d-flow插件使用
/* var swiper = new Swiper('.swiper-container',{
tdFlow:{
rotate:60,
stretch:40,
depth:100,
modifier:1,
shadows:true
}
});
*/ //demo4 scroll-bar插件使用
/* var swiper = new Swiper('.swiper-container',{
scrollbar:{
container:'.swiper-scrollbar',
draggable:true,
hide:true,
snapOnRelease:true
}
}); */ //tabs切换综合示例
var swiper = new Swiper('.swiper-container',{
onSlideChangeStart:function(swiper){
var index = swiper.activeIndex;
$('.tabs a').removeClass('active');
$('.tabs a').eq(index).addClass('active');
}
}); $('.tabs a').click(function(e){
e.preventDefault();
var index = $(this).index();
$('.tabs a').removeClass('active');
$(this).addClass('active');
swiper.swipeTo(index);
return false;
});
swiper tabs综合示例的更多相关文章
- Spring MVC 学习总结(四)——视图与综合示例
一.表单标签库 1.1.简介 从Spring2.0起就提供了一组全面的自动数据绑定标签来处理表单元素.生成的标签兼容HTML 4.01与XHTML 1.0.表单标签库中包含了可以用在JSP页面中渲染H ...
- C#与数据库访问技术总结(七)综合示例
综合示例 说明:前面介绍了那么多,光说不练假把式,还是做个实例吧. 表:首先你要准备一张表,这个自己准备吧.我们以学生表为例. 1.ExecuteScalar方法 ExecuteScalar方法执行返 ...
- 前端MVC Vue2学习总结(一)——MVC与vue2概要、模板、数据绑定与综合示例
一.前端MVC概要 1.1.库与框架的区别 框架是一个软件的半成品,在全局范围内给了大的约束.库是工具,在单点上给我们提供功能.框架是依赖库的.Vue是框架而jQuery则是库. 1.2.AMD与CM ...
- LayUI后台管理与综合示例
一.LayUI介绍 layui(谐音:类UI) 是一款采用自身模块规范编写的前端 UI 框架,遵循原生 HTML/CSS/JS 的书写与组织形式,门槛极低,拿来即用.其外在极简,却又不失饱满的内在,体 ...
- ElasticSearch7.3学习(三十二)----logstash三大插件(input、filter、output)及其综合示例
1. Logstash输入插件 1.1 input介绍 logstash支持很多数据源,比如说file,http,jdbc,s3等等 图片上面只是一少部分.详情见网址:https://www.elas ...
- retrofit okhttp RxJava bk Gson Lambda 综合示例【配置】
项目地址:https://github.com/baiqiantao/retrofit2_okhttp3_RxJava_butterknife.git <uses-permission andr ...
- 分享我基于NPOI+ExcelReport实现的导入与导出EXCEL类库:ExcelUtility (续2篇-模板导出综合示例)
自ExcelUtility类推出以来,经过项目中的实际使用与不断完善,现在又做了许多的优化并增加了许多的功能,本篇不再讲述原理,直接贴出示例代码以及相关的模板.结果图,以便大家快速掌握,另外这些示例说 ...
- 前端MVC Vue2学习总结(七)——ES6与Module模块化、Vue-cli脚手架搭建、开发、发布项目与综合示例
使用vue-cli可以规范项目,提高开发效率,但是使用vue-cli时需要一些ECMAScript6的知识,特别是ES6中的模块管理内容,本章先介绍ES6中的基础与模块化的内容再使用vue-cli开发 ...
- Spring Boot 2.x 综合示例-整合thymeleaf、mybatis、shiro、logging、cache开发一个文章发布管理系统
一.概述 经过HelloWorld示例(Spring Boot 2.x 快速入门(上)HelloWorld示例)( Spring Boot 2.x 快速入门(下)HelloWorld示例详解)两篇的学 ...
随机推荐
- 【贪心】数列分段Section I luogu-1181
题目描述 对于给定的一个长度为\(N\)的正整数数列\(A_i\),现要将其分成连续的若干段,并且每段和不超过\(M\)(可以等于\(M\)),问最少能将其分成多少段使得满足要求. 分析 简单思考一下 ...
- [蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用
目录 前言 1.编译 Ubertooth tools 1.1.准备工作 1.2.编译安装 libbtbb 1.3.编译安装 Ubertooth tools 1.4.Wireshark 插件 1.5.更 ...
- 微信小程序账号注册
想要开发微信小程序,先注册账号申请APPID. 第一步:百度搜索"微信公众平台" 第二步:立即注册 进入注册页面 区别: 订阅号: 订阅号在文件夹里,订阅号消息 一天只能推送一次, ...
- 生成python 依赖文件
1.生成requirement 文件的两种方式 1. 'pip freeze ' > requirements.txt --会将环境中的依赖包全都加入(不推荐) 2. 项目用到生成依赖 '# 安 ...
- (6java)计算机语言发展史
(6java)计算机语言发展史 机器语言: 程序是0和1的组合,比如:0000.0001.1100110 汇编语言: 程序比机器语言好理解一点点 高级语言: 比较适合老美,苦了英语差的孩子们了,哈哈. ...
- MP4命令行处理
MP4Box可用于生成符合MPEG-DASH规范的内容,也就是ISO / IEC 23009-1在ISO公共可用标准中可用的内容. dash切片命令: mp4box -dash 5000 -frag ...
- videojs文档翻译-api
直播流地址 rtmp://live.hkstv.hk.lxdns.com/live/hks API 接口 (一) Modules 模块 1) browser :浏览器 2) ...
- Springboot 配置文件、隐私数据脱敏的最佳实践(原理+源码)
大家好!我是小富- 这几天公司在排查内部数据账号泄漏,原因是发现某些实习生小可爱居然连带着账号.密码将源码私传到GitHub上,导致核心数据外漏,孩子还是没挨过社会毒打,这种事的后果可大可小. 说起这 ...
- ECShop 2.x/3.x SQL注入/任意代码执行漏洞
poc地址:https://github.com/vulhub/vulhub/blob/master/ecshop/xianzhi-2017-02-82239600/README.zh-cn.md 生 ...
- 洛谷P3067题解
题面 首先,对于每个数,有三种状态:选入集合A,选入集合B,或者不选入集合.暴力枚举的时间复杂度是 \(O(n\times3^n)\) ,显然跑不过去. 因此考虑 \(\text{Meet in Mi ...