swiper(移动端触摸滑动插件)

tip:自己敲得Swiper 的小demo,可以复制粘贴看看效果哦。

swiper的js包css包下链接地址 :  https://github.com/Clearlovesky/swiper3.4.2


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Swiper demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/swiper.min.css">
<style>
  html, body {
  position: relative;
  height: 100%;
}
body {
  background: #eee;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color:#000;
  margin: 0;
  padding: 0;
}
.swiper-container {
  width: 100%;
  height: 100%;
}
.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;
  /* Center slide text vertically */
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  /*display: flex;*/
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  /*-webkit-align-items: center;
  align-items: center;*/
}
.swiper-pagination{
  top: 0;
  height: 3rem;
  width: 100%;
  background-color: #386bdb;
  text-align: left;
}
.swiper-pagination-bullet{
  width: 12%;
  height: 3rem;
  text-align: center;
  border-radius: 0;
  font-size: 1rem;
  line-height: 3rem;
  color: #fff;
  opacity: 0.6;
  background-color: transparent;
}
.swiper-pagination-bullet-active{
  opacity: 1;
}
.swiper-pagination-bullet:nth-child(1):before{/*在元素的内容之前插入新内容;*/
  content:"热门";/*所插入的内容*/
}
.swiper-pagination-bullet:nth-child(2):before{
  content:"关注";
}
.swiper-pagination-bullet:nth-child(3):before{
  content:"话题";
}
.swiper-pagination-bullet:nth-child(4):before{
  content:"问答";
}
/*第一个swiper里的小swiper*/
.swiper-container-h {
  width: 100%;
  height: 19.0rem;
  margin-top:3.5rem; 
  background-color: pink;
  overflow: hidden;
}
.swiper-container-h>.swiper-wrapper{
  margin: 30px 15px;
  height: 15.0rem;
}
.swiper-container-h>.swiper-wrapper>.swiper-slide{
  background-color: #ccc;
  height: 15rem;
  line-height: 15rem;
} /*第二屏*/
.one{
  height: 100%;
  width: 100%;
  /*background-color: #ccc;*/
  margin-top: 3.5rem;
  line-height: 10rem;
}
.one1,.one2,.one3{
  height: 10rem;
  width: 100%;
  background-color: pink;
  margin-top: .1em;
  line-height: 10rem;
}
/*第三屏*/
.two{
  height: 100%;
  width: 100%;
  background-color: pink;
  margin-top: 3.5rem;
}
</style>
</head>
<body>
<div class="swiper-container">
  <div class="swiper-wrapper">
  <!-- 热门 第一屏start -->
  <div class="swiper-slide">
  <div class="swiper-container-h">   <div class="swiper-wrapper">
    <div class="swiper-slide">雄</div>
    <div class="swiper-slide">的</div>
    <div class="swiper-slide">传</div>
    <div class="swiper-slide">说</div>
  </div>
</div>
</div>
<!-- 热门 第一屏end -->
<div class="swiper-slide">
  <div class="one">
    <div class="one1">1111</div>
    <div class="one2">2222</div>
    <div class="one3">3333</div>
  </div>
</div>
<div class="swiper-slide">
  <div class="two">4444</div>
</div>
<div class="swiper-slide">问答</div>
</div>
<!-- tab栏的头部导航按钮 -->
<div class="swiper-pagination">
<span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span>
<span class="swiper-pagination-bullet"></span>
<span class="swiper-pagination-bullet"></span>
<span class="swiper-pagination-bullet"></span>
</div>
</div>
<script src="js/swiper.min.js"></script>
<script>
  var swiper = new Swiper('.swiper-container', {
  pagination: '.swiper-pagination',
  paginationClickable: true,
  // spaceBetween: 50
  });
  var swiperH = new Swiper('.swiper-container-h', {
  // pagination: '.swiper-pagination',
  slidesPerView: 1.6,//屏幕显示小div的个数
  paginationClickable: true,
  spaceBetween: 30,
  freeMode: true
  });
</script>
</body>
</html>

swiper嵌套小demo(移动端触摸滑动插件)的更多相关文章

  1. 移动端触摸滑动插件Swiper

    移动端触摸滑动插件Swiper 04/02/2015 一.了解Swiper 目前移动端项目一般都需要具有触屏焦点图的效果,如果你也需要实现这一功能的话,Swiper是一个不错的选择. 1.他不需要加载 ...

  2. 移动端触摸滑动插件Swiper使用指南

    Swiper是一款开源.免费.功能十分强大的移动端内容触摸滑动插件,目前的最新版本是Swiper4.Swiper主要面向的是手机.平板电脑等移动设备,帮助开发者轻松实现触屏焦点图.触屏Tab切换.触屏 ...

  3. Swipe-移动端触摸滑动插件swipe.js

    原文链接:http://caibaojian.com/swipe.html 插件特色 viaswipe.JS是一个比较有名的触摸滑动插件,它能够处理内容滑动,支持自定义选项,你可以让它自动滚动,控制滚 ...

  4. swiper.js 移动端触摸滑动插件

    API链接: http://www.swiper.com.cn/api/start/2014/1218/140.html <body> <div class="swiper ...

  5. Swiper --移动端触摸滑动插件

    Swiper使用方法 1.首先加载插件,需要用到的文件有swiper.min.js和swiper.min.css文件. <!DOCTYPE html> <html> <h ...

  6. 仿移动端触摸滑动插件swiper,的简单实现

    ​ /** * @author lyj * @Date 2016-02-04 * @Method 滑动方法 针对一个大容器内部的容器做滑动封装 * @param * args args.swipeDo ...

  7. JS封装移动端触摸滑动插件应用于导航banner【精装版】

    自己封装了一个小插件,一个小尝试. 可用于类似于京东导航等效果,效果多样化,很方便. 欢迎大家提点意见. mrChenSwiper(  {parent, child, type, parentN, c ...

  8. 最好的移动触摸滑动插件:Swiper

    最近在使用的一个移动触摸滑动插件Swiper,功能很强大,跟之前的那个swipe.JS相比,同时支持在PC端滑动,支持上下方向滑动,支持多张图片滑动,支持多屏滑动,凡是你想得到的几乎都可以实现.最近作 ...

  9. 自己用原生JS写的轮播图,支持移动端触摸滑动,分页器圆点可以支持mouseover鼠标移入和click点击,高手看了勿喷哈

    自己用原生JavaScript写的轮播图,分页器圆点按钮可支持click点击,也可支持mouseover鼠标悬浮触发,同时支持移动端触摸滑动,有兴趣的友友可以试试哈,菜鸟一枚,高手看了勿喷,请多多指正 ...

随机推荐

  1. 在Mac平台上安装配置ELK时的一些总结

    一.前言 大数据处理是流行的一些表现,在不断壮大的数据处理中,怎么样处理数据才是我们继续做好开发的正道.本文章来自网络,不敢原创,但是也有很大借鉴.   二.MAC安装ELK   首先是安装elast ...

  2. PLC是嵌入式系统吗?【转】

    PLC是嵌入式系统吗? 一.PLC即Programmable Logic Controller,可编程逻辑控制器 单片机又名MCU即microprocessor control unit,微处理机控制 ...

  3. Java通过SMS短信平台实现发短信功能

    在项目中使用过发短信的功能,但那个由于公司内部的限制很麻烦,今天在网上找到一个简单的,闲来无事就把它记录如下: 本程序是通过使用中国网建提供的SMS短信平台实现的(该平台目前为注册用户提供5条免费短信 ...

  4. Docker 集群Swarm创建和Swarm Web管理

    关于Docker Swarm更多的介绍请查看<Docker管理工具-Swarm部署记录> 一.环境配置 1.安装环境 # cat /etc/redhat-release CentOS Li ...

  5. DLLImport的用法C#

    它来调用WIN32的API或者调用一下C或C++编写的DLL.使用实例:将编译好的C++ DLL拷贝到BIN目录(DLLImport会从程序启动目录BIN开始查找相应名称的DLL,未找到则转至syst ...

  6. 每天一个linux命令(7):mv

    1.命令简介 mv(Move file)将源文件重命名为目标文件,或将源文件移动至指定目录.. 2.用法 mv [选项]... [-T] 源文件 目标文件 或:mv [选项]... 源文件... 目录 ...

  7. echarts参数详解--散点图

    参考地址:http://www.cnblogs.com/weizhen/p/5907617.html <!-- 1.首先需要下载包echarts.js,然后引入该包 --> <!DO ...

  8. C#缓存absoluteExpiration、slidingExpiration两个参数的疑惑

    看了很多资料终于搞明白cache中absoluteExpiration,slidingExpiration这两个参数的含义. absoluteExpiration:用于设置绝对过期时间,它表示只要时间 ...

  9. Unity应用架构设计(4)——设计可复用的SubView和SubViewModel(Part 2)

    在我们设计和开发应用程序时,经常要用到控件.比如开发一个客户端WinForm应用程序时,微软就为我们提供了若干控件,这些控件为我们提供了可被定制的属性和事件.属性可以更改它的外观,比如背景色,标题等, ...

  10. 生成建表脚本up_CreateTable

    已经很久没用使用这个脚本了,今天用到,并做修改,增加了生成扩展属性功能. Go if object_ID('[up_CreateTable]') is not null Drop Procedure ...