• swiper之PC端的广告页面【当前示例对应网站:http://shang.shuaishou.com/】

plugins:【红线部分】

html:

<div class="banner swiper-container">
<ul class="list-none swiper-wrapper">
<li class="swiper-slide"><a href="#"><img src="../img/index/banner1.png"></a></li>
<li class="swiper-slide"><a href="#"><img src="../img/index/banner1.png"></a></li>
<li class="swiper-slide"><a href="#"><img src="../img/index/banner1.png"></a></li>
</ul>
<!-- 如果需要分页器 -->
<div class="pagination"></div>
<!-- 如果需要导航按钮 -->
<a class="arrow arrow-left" href="javascript:void(0)"></a>
<a class="arrow arrow-right" href="javascript:void(0)"></a>
</div>

css:

@mixin transition($property:all,$time:.5s,$func:linear){
-webkit-transition: $property $time $func;
-moz-transition: $property $time $func;
-ms-transition: $property $time $func;
-o-transition: $property $time $func;
transition: $property $time $func;
}
.swiper-pagination-switch {
display: inline-block;
width: 8px;
height: 8px;
background: #fff;
margin: 0 5px;
cursor: pointer;
opacity: .8;
@include transition(height,.5s);
}
.swiper-active-switch {
height:20px;
opacity:;
}
.swiper-container .pagination {
position: absolute;
margin:;
z-index:;
right:5px;
bottom: 10px;
width: 100%;
text-align: right;
}
.swiper-container{
width:100%;
height:auto;
}
.swiper-container .arrow-left{
left:50px;
}
.swiper-container .arrow-right{
right: 50px;
background-position: -50px 0;
}
.swiper-container .arrow-left,.swiper-container .arrow-right{
display:none;
background-image: url(../img/indexSlideArrow.png);
background-repeat: no-repeat;
background-size: 260%;
position: absolute;
top: 50%;
margin-top: -25px;
width: 30px;
height: 50px;
z-index:;
}

javascript:

(function(w,$){
var indexObj = {
init:function(){
indexObj.swiperInit();
},
swiperInit:function(){
var _siwper = ".index .swiper-container";
var swiper = new Swiper(_siwper, {
autoplay:3000,
speed:400,
mode: 'horizontal',
loop: true,
calculateHeight: true,//自动高度
// 如果需要分页器
pagination: '.index .pagination',
paginationClickable:true
});
var $swiper = $(_siwper),
$arrow = $swiper.find('.arrow');
$swiper.on("mouseenter",function(){
swiper.stopAutoplay();
$arrow.addClass("active");
});
$swiper.on("mouseleave",function(){
swiper.startAutoplay();
$arrow.removeClass("active");
});
$swiper.find('.arrow-left').click(function(){
swiper.swipePrev();
});
$swiper.find('.arrow-right').click(function(){
swiper.swipeNext();
});
}
};
$(indexObj.init);
})(window,jQuery);

页面效果:

swiper之移动端tab切换

plugins:导入swiper4版本

html:

    <link href="https://cdn.bootcss.com/Swiper/4.2.2/css/swiper.min.css" rel="stylesheet">

<div class="swiper-container" id="selectBanner">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="banner-img">
<img src="../imgs/banner.jpg">
<span class="bi-time bg-red">2018-01-20下午2点</span>
<p class="bi-text">
<span class="ci-t">0基础打包爆款!200人已报名</span>
<a href="#" class="bg-red">立即报名</a>
</p>
</div>
</div>
<div class="swiper-slide">
<div class="banner-img">
<img src="../imgs/banner.jpg">
<span class="bi-time bg-red">2018-01-20下午2点</span>
<p class="bi-text">
<span class="ci-t">0基础打包爆款!200人已报名</span>
<a href="#" class="bg-red">立即报名</a>
</p>
</div>
</div>
</div>
<!--&lt;!&ndash; 如果需要分页器 &ndash;&gt;-->
<div class="swiper-pagination"></div>
</div>

scss:

.select-tab{
background-color: #fff;
height:1rem;
line-height: .96rem;
text-align: center;
@include ul-reset();
.border-bottom{
&:after{
@include position($bottom:0.08rem,$left:-70%);
content:"";
width:70%;
height:3px;
background-color: $theme;
//@include transition(left);
}
}
li,.swiper-pagination-bullet{
display:inline-block;
width:50%;
height:100%;
float:left;
@include radius(0);
margin:;
background: #fff;
opacity:;
&.active{
a{
@include color-link($theme,$theme);
&:after{
left:15%;
}
}
}
}
a{
display:inline-block;
position: relative;
overflow: hidden;
@include color-link();
@extend .border-bottom;
}
.swiper-pagination-bullet{
i{
position:relative;
display:inline-block;
overflow: hidden;
@extend .border-bottom;
}
}
}
.tab{
&.detail{
background-color: $bg;
&.swiper-container-horizontal{
height:auto;
padding-top: 1.533326rem;
}
.swiper-wrapper{
background-color: #fff;
}
.swiper-pagination-bullets{
top:.266666rem;
}
}
&.swiper-container-horizontal{
height:100%;
padding-top: 1.266667rem;
}
.swiper-pagination-bullets{
bottom:auto;
top:;
left:;
width:100%;
@extend .select-tab;
.swiper-pagination-bullet-active{
background-color: #fff;
color:$theme;
i:after{
left:15%;
}
}
}
.swiper-wrapper .swiper-slide{
overflow-x: hidden;
overflow-y: auto;
overflow-scrolling: touch;
}
}
@keyframes border-move {
0%{
left:-70%;
}
100%{
left:15%;
}
}
@-webkit-keyframes border-move{
0%{
left:-70%;
}
100%{
left:15%;
}
}
.swiper-container-horizontal{
.swiper-pagination-bullets{
bottom:.8rem;
}
}
.swiper-pagination-bullet-active{
background-color: $theme;
}

javascript:

<script src="https://cdn.bootcss.com/Swiper/4.2.2/js/swiper.min.js"></script>
<script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script> (function(){
    var mySwiper = new Swiper ('#selectCon', {
pagination: {
el: '.swiper-pagination',
clickable: true,
renderBullet: function (index, className) {
var text;
switch (index) {
case 0:
text = '详情课程';
break;
case 1:
text = '课程大纲';
break;
}
return '<span class="' + className + '" style="opacity:1;"><i>' + text + '</i></span>'
}
}
});
})();

效果:

swiper 应用的更多相关文章

  1. swiper插件 纵向内容超出一屏解决办法

    1.css .swiper-slide { overflow: auto; } 2.js var swiper = new Swiper('.swiper-container', { directio ...

  2. swiper的初步使用

    1.引入文件,顺序引入(此处基于jquery,且版本至少1.7以上) <link rel="stylesheet" href="path/to/swiper-3.4 ...

  3. 关于移动端swiper的2种样式重置

    手机查看效果地址:猛戳 ,PC端查看可以缩放浏览器窗口看效果~~ 思路:主要考虑选择器优先级大于默认就可以随意撸码 注意:该demo里用的mobile-adaptive.js是让页面以rem自适应,也 ...

  4. ReactNative新手学习之路04 组件化开发轮播图swiper支持安卓和IOS

    react native 新手之路04 组件化开发轮播图swiper支持安卓和IOS npm install react-native-carousel --save git 地址Properties ...

  5. swiper框架,实现轮播图等滑动效果

    http://www.swiper.com.cn/ 做个记录而已,这个没什么好说的,对于需要手机端开发实现触摸等方式可以看看.

  6. swiper.animate~之~可以执行两种动画的升级版的Swiper Animate

        1.下载插件swiper.animate-twice.min.js,加载进页面. <!DOCTYPE html> <html> <head> ... < ...

  7. swiper横向轮播--3d

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

  8. swiper横向轮播(兼容IE8)

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

  9. Swiper说明&&API手册 【中文手册Swiper】

     原文地址:http://www.cnblogs.com/scavengers/p/3760449.html 示例: <link rel="stylesheet" href= ...

  10. Swiper 中文API手册(share)

    本文分享自 http://www.cnblogs.com/scavengers/p/3760449.html ---------------------------华丽的分割线------------ ...

随机推荐

  1. Lucene详解

    一.lucene原理 Lucene 是apache软件基金会一个开放源代码的全文检索引擎工具包,是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎.它不是一个完整的搜索应用程序 ...

  2. java开源安全框架-------Apache Shiro--第二天

    身份验证 即在应用中谁能证明他就是他本人.一般提供如他们的身份ID一些标志信息来表明他就是他本人,如提供身份证.用户名.密码来证明 在shiro中,用户需要提供principals(身份)和crede ...

  3. 查看Linux内核版本之lsb_release

    lsb_release命令LSB是Linux Standard Base的缩写,lsb_release命令用来显示LSB和特定版本的相关信息,可通过yum -y install redhat-lsb命 ...

  4. java基础笔记(8)----接口

    接口 是特殊的抽象类,纯抽象类---所有方法都是抽象方法 接口和抽象类的区别: 相同点: 编译后,会分别生成对应的.class文件 都不能创建对象(实例化),但是可以生成引用(使用多态) 不同点: 抽 ...

  5. Entity Framework——并发策略

    使用EF框架遇到并发时,一般采取乐观并发控制. 1支持并发检验 为支持并发检验,需要对实体进行额外的设置.默认情况下是不支持并发检验的.有以下两种方式: 方式名称 说明 时间戳注解/行版本 使用Tim ...

  6. ReentrantLock 与 AQS 源码分析

    ReentrantLock 与 AQS 源码分析 1. 基本结构    重入锁 ReetrantLock,JDK 1.5新增的类,作用与synchronized关键字相当,但比synchronized ...

  7. C++多线程学习之(一)——并发与多线程

    1 并发 计算机领域的并发指的是在单个系统里同时执行多个独立的任务,而非顺序地进行一些活动. 1.1 并发的途径 多进程并发:将应用程序分为多个独立的进程,它们在同一时刻运行,就像同时进行网页浏览和文 ...

  8. 关于DLL的创建与使用简单描述(C++、C#)

    前言 前一段时间在学关于DLL的创建与调用,结果发现网络上一大堆别人分享的经验都有点问题.现在整理分享一下自己的方法. 工具 Microsoft Visual Studio 2017 depends ...

  9. python实现线性回归

    参考:<机器学习实战>- Machine Learning in Action 一. 必备的包 一般而言,这几个包是比较常见的: • matplotlib,用于绘图 • numpy,数组处 ...

  10. fflush(stdin)与fflush(stdout)

    1.fflush(stdin): 作用:清理标准输入流,把多余的未被保存的数据丢掉.. 如: int main() { int num; char str[10]; cin>>num; c ...