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综合示例的更多相关文章

  1. Spring MVC 学习总结(四)——视图与综合示例

    一.表单标签库 1.1.简介 从Spring2.0起就提供了一组全面的自动数据绑定标签来处理表单元素.生成的标签兼容HTML 4.01与XHTML 1.0.表单标签库中包含了可以用在JSP页面中渲染H ...

  2. C#与数据库访问技术总结(七)综合示例

    综合示例 说明:前面介绍了那么多,光说不练假把式,还是做个实例吧. 表:首先你要准备一张表,这个自己准备吧.我们以学生表为例. 1.ExecuteScalar方法 ExecuteScalar方法执行返 ...

  3. 前端MVC Vue2学习总结(一)——MVC与vue2概要、模板、数据绑定与综合示例

    一.前端MVC概要 1.1.库与框架的区别 框架是一个软件的半成品,在全局范围内给了大的约束.库是工具,在单点上给我们提供功能.框架是依赖库的.Vue是框架而jQuery则是库. 1.2.AMD与CM ...

  4. LayUI后台管理与综合示例

    一.LayUI介绍 layui(谐音:类UI) 是一款采用自身模块规范编写的前端 UI 框架,遵循原生 HTML/CSS/JS 的书写与组织形式,门槛极低,拿来即用.其外在极简,却又不失饱满的内在,体 ...

  5. ElasticSearch7.3学习(三十二)----logstash三大插件(input、filter、output)及其综合示例

    1. Logstash输入插件 1.1 input介绍 logstash支持很多数据源,比如说file,http,jdbc,s3等等 图片上面只是一少部分.详情见网址:https://www.elas ...

  6. retrofit okhttp RxJava bk Gson Lambda 综合示例【配置】

    项目地址:https://github.com/baiqiantao/retrofit2_okhttp3_RxJava_butterknife.git <uses-permission andr ...

  7. 分享我基于NPOI+ExcelReport实现的导入与导出EXCEL类库:ExcelUtility (续2篇-模板导出综合示例)

    自ExcelUtility类推出以来,经过项目中的实际使用与不断完善,现在又做了许多的优化并增加了许多的功能,本篇不再讲述原理,直接贴出示例代码以及相关的模板.结果图,以便大家快速掌握,另外这些示例说 ...

  8. 前端MVC Vue2学习总结(七)——ES6与Module模块化、Vue-cli脚手架搭建、开发、发布项目与综合示例

    使用vue-cli可以规范项目,提高开发效率,但是使用vue-cli时需要一些ECMAScript6的知识,特别是ES6中的模块管理内容,本章先介绍ES6中的基础与模块化的内容再使用vue-cli开发 ...

  9. Spring Boot 2.x 综合示例-整合thymeleaf、mybatis、shiro、logging、cache开发一个文章发布管理系统

    一.概述 经过HelloWorld示例(Spring Boot 2.x 快速入门(上)HelloWorld示例)( Spring Boot 2.x 快速入门(下)HelloWorld示例详解)两篇的学 ...

随机推荐

  1. Java 获取Word中指定图片的坐标位置

    本文介绍通过Java程序获取Word文档中指定图片的坐标位置. 程序运行环境: Word测试文档:.docx 2013 Free Spire.doc.jar 3.9.0 IntelliJ IDEA J ...

  2. python项目案例

    python项目案例1:----此学习案例用python3编写,摘自明日科技,感谢! 学生管理系统: 功能描述:具有增删改查,排序,保存并显示学生的全部信息. 1.主界面---函数menu(),显示功 ...

  3. odoo检查规则

    @api.multidef button_cancel(self): for move in self: if not move.journal_id.update_posted: raise Use ...

  4. 第十四篇 -- CPU学习二——此部分重点在AMD CPU

    一.CPU的一些英文简写或解释 Definitions: ACPI--Advanced Configuration and Power Interface APP--Adjusted Peak Per ...

  5. maven之---资源过滤 在java/main/resourse/*.xml ,*.properties引用maven属性${db.username}

    本文主要来源maven实战14.3 为了应对环境的变化,首先使用Maven属性将这个会发生变化的部分提取出来.在上一节的数据库配置中,连接数据库使用的驱动类,URL,用户名和密码都可能发生变化,因此使 ...

  6. 基于STC51单片机的霓虹灯

    基于STC51单片机的霓虹灯 设计要求: 使用PWM驱动8个LED灯 人眼不能观察到灯光全灭 灯光要有动画效果 设计概述: ​  按照设计要求,为了更直观的说明脉冲宽度调制技术(PWM),所以霓虹灯的 ...

  7. linux ifconfig不可用

    Q: A: 源出问题,修改源:进入源:源地址 /etc/apt/ sudo vi sources.list,将下列内容替换sources.list中的内容,并保存 deb http://mirrors ...

  8. solr(CVE-2019-0193)远程命令执行

    影响版本 Apache Solr < 8.2.0 并且开启了DataImportHandler模块(默认情况下该模块不被启用) 安装 重启daoker  更新配置文件 systemctl dae ...

  9. "virtualbox for mac安装器遇到了一个错误, 导致安装失败. 请联系软件制造商以获得帮助"的解决办法

    virtualbox下载地址: https://www.virtualbox.org/wiki/Downloads 原因:"Mac OS 10.13.4 会阻止外部内核扩展的安装" ...

  10. TypeScript学习笔记(四)装饰器

    目录 一.装饰器的作用 二.类装饰器 1. 普通装饰器 为类扩展属性和方法 使用装饰器修改属性和重写方法 2. 装饰器工厂 三.属性装饰器 四.方法装饰器 使用方法装饰器对方法进行扩展 五.方法参数装 ...