Swiper插件的使用
1、HTML
<!-- Swiper -->
<section class="swipper">
<div class="swiper-button-next"></div>
<div class="nav-swipper swiper-container swiper-container-horizontal">
<div class="swiper-wrapper">
<div class="swiper-slide"><span class="now"><b><img src="data:images/swiper-1.png" height="25" width="auto" alt=""></b>股票</span></div>
<div class="swiper-slide"><span><b><img src="data:images/swiper-2.png" height="25" width="auto" alt=""></b>债券</span></div>
<div class="swiper-slide"><span><b><img src="data:images/swiper-3.png" height="25" width="auto" alt=""></b>公益</span></div>
<div class="swiper-slide"><span><b><img src="data:images/swiper-4.png" height="25" width="auto" alt=""></b>实物</span></div>
<div class="swiper-slide"><span><b>你猜</b>测试</span></div>
<div class="swiper-slide"><span><b>再猜</b>测试</span></div>
</div>
<!-- Add Pagination -->
<!-- <div class="swiper-pagination"></div> -->
</div>
<div class="swiper-button-prev"></div>
<!-- Swiper End-->
</section>
 2、CSS
.nav-swipper{background: #F2F2F2;height: 78px;box-sizing: border-box;}
/*.nav-swipper .swiper-wrapper{margin: 0px 24px;}*/
.nav-swipper .swiper-slide {margin: 0px;text-align: center; font-size: 13px;color: #999; background: #F2F2F2; 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; }
section.swipper {border-top: 1px solid #979797;padding: 0px 24px;position: relative;}
section.swipper .swiper-button-prev{top:50%;background-image:url(../images/swiper-pre.png);background-size: 12px auto;left: 10px;right: auto;width: 12px;height: 19px;}
section.swipper .swiper-button-next{top:50%;background-image:url(../images/swiper-next.png);background-size: 12px auto;left: auto;right: 10px;width: 12px;height: 19px;}
.nav-swipper span { display: inline-block; vertical-align: top;height: 64px; }
.nav-swipper b { height: 42px; display: table-cell; vertical-align: middle; width: 42px; text-align: center; background: #F7F7F7; border-radius: 50%; border: #fff 1px solid; color: #ccc; box-shadow: 0px 1px 3px #999; }
.nav-swipper span.now b{border-color: #FF6602;}

3、JS

var swiper = new Swiper('.nav-swipper', {
pagination: '.swiper-pagination',
slidesPerView: 4,
paginationClickable: true,
spaceBetween: 0,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
});
 “swiper-button-next”和“swiper-button-prev”两个button是可以脱离在“swiper-container”外面的。因为“swiper-container”的Margin-left起作用,但是Margin-right不起作用(设置了over-flow:hidden),所以没有办法设置“swiper-container”的外边距。但是可以在“swiper-container”外面加一个容器,然后设置它的padding,再把“向左、向右的按钮”放在padding的间距里面。padding 要使用px,rem有时候不起作用。
 
swiper使用的一般方法如链接所示:http://www.swiper.com.cn/usage/index.html

Swiper使用方法(向前和向后按钮在swiper-container外面)的更多相关文章

  1. 普通选项卡+自动播放功能+向前/向后按钮 原生js

    今天做了幻灯片,主要功能包括:普通选项卡,向前/向后播放按钮,向前?向后播放功能,自动播放功能 要实现简单选项卡功能是没有问题的,但是添加功能就出现各种各样的问题了 遇到的问题:1 下标问题 2普通选 ...

  2. Swiper使用方法

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

  3. 解决pycharm新建项目后按钮灰色问题

    解决pycharm新建项目后按钮灰色问题 出现过多次该问题了, 在此记录一下 同样适用于导入别人的新项目后无法运行问题 原因一: pycharm没有设置系统解析器 解决方法一: 打开pycharm-& ...

  4. js中表单提交后按钮变灰色的功能

    表单提交后按钮变成灰色 http://www.111cn.net/wy/js-ajax/45299.htm

  5. Java 中 List 向前和向后遍历

    Java 中 List 向前和向后遍历 import java.util.*; public class TestCollectionIterator { public static void mai ...

  6. C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法

    原文:C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法 本人新手,在.Net中写WebAPI的时候,当接口返回的json数据含有日期时间类型的字段时, ...

  7. form单提交后按钮变成失效变灰

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  8. protobuf 向前兼容向后兼容

    http://blog.163.com/jiang_tao_2010/blog/static/12112689020114305013458/ 不错的protobuf.. protobuf的编码方式: ...

  9. angularjs 水平滚动选中按钮高亮显示 swiper和回到顶部指令的实现ionic

    首先安装 swiper npm install --save swiper 或者 bower install --save swiper <link rel="stylesheet&q ...

随机推荐

  1. ROS Learning-008 beginner_Tutorials ROS话题

    ROS Indigo beginner_Tutorials-07 ROS话题 我使用的虚拟机软件:VMware Workstation 11 使用的Ubuntu系统:Ubuntu 14.04.4 LT ...

  2. cannot convert from 'wchar_t *' to 'char *' 问题

    MFC中使用unicode 会导致cstring之间的转换变的很复杂 经常遇到这样的错误cannot convert from 'wchar_t *' to 'char *' 强制转换成wchar_t ...

  3. Halcon小函数的封装和代码导出

    一.Halcon小函数的封装和修改 1.名词解释: 算子:指Halcon中最基础.最底层的函数(即你看不到它的代码实现),一个算子只有一句话,例如threshold算子. 小函数:由多个算子组合成的函 ...

  4. LayDate 时间选择插件的使用介绍 (低版本1.0好像是)

    <span style="font-size:18px;"><!doctype html> <html> <head> <me ...

  5. python 调试方法

    一.使用pdb http://blog.csdn.net/wyb_009/article/details/8896744 二.使用gdb 需首先配置gdb pythin支持,步骤如下: 1.修改Pyt ...

  6. Telnet 协议详解

    Telnet 协议详解 一.概述 ============================================================ Telnet 协议是 TCP/IP 协议族中 ...

  7. 设计社区类Web原型制作分享-Behance

    Behance 是著名设计社区,创意设计人士可以展示自己的作品,发现别人分享的创意作品. 网站有二级导航,主要用到的交互组件有弹出面板,通过弹出面板来隐藏展现搜索框.并且用到的组件有播放器.菜单栏.下 ...

  8. 移动文件读/写指针----lseek

    头文件:#include<sys/types.h>.#include<unistd.h> 函数原型:off_t lseek(int fildes,off_t offset,in ...

  9. jQuery获得元素位置offset()和position()的区别

    jQuery获得元素位置offset()和position()的区别 jQuery 中有两个获取元素位置的方法offset()和position(),这两个方法之间有什么异同 offset(): 获取 ...

  10. 2018.08.28 洛谷P3345 [ZJOI2015]幻想乡战略游戏(点分树)

    传送门 题目就是要求维护带权重心. 因此破题的关键点自然就是带权重心的性质. 这时发现直接找带权重心是O(n)的,考虑优化方案. 发现点分树的树高是logn级别的,并且对于以u为根的树,带权重心要么就 ...