swiper使用心得

  • 引入:
  • <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
  • <script src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.min.js"></script>
  • 创建:html
 1         <div class="banner">
 2             <div class="swiper-container">
 3                 <div class="swiper-wrapper">
 4                     <div class="swiper-slide swiper-slide_ban1">
 5                         <div class="inner">
 6                             <div class="download">
 7                                 <a href="javascript:Get_layer(‘./webroot/layer.html‘,‘721px‘,‘482px‘)"><img src="./webroot/images/bannerdwnews_04.png" alt=""></a>
 8                             </div>
 9                         </div>
10                     </div>
11                     <div class="swiper-slide">
12                         <img src="./webroot/images/reBnner_03.jpg" alt="">
13                     </div>
14                 </div>
15                 <!-- Add Pagination -->
16                 <div class="swiper-pagination"></div>
17                 <!-- Add Arrows -->
18                 <div class="swiper-button-next"></div>
19                 <div class="swiper-button-prev"></div>
20             </div>
21         </div>
  • 创建css样式
 1 /*banner start*/
 2 .banner .swiper-slide_ban1{
 3     height: 487px;
 4     background: url(../images/rebnner_02.png) no-repeat;
 5     background-position: center;
 6     position: relative;
 7 }
 8 .banner .swiper-slide_ban1 .download{
 9     position:relative;
10     width:100%;
11     height:478px;
12 }
13 .banner .swiper-slide_ban1 .download a>img{
14        position: absolute;
15     top: 279px;
16     left: 450px;
17 }
18 .banner .swiper-slide_ban1 .download a:hover{
19     cursor: pointer;
20 }
  • 创建js
 1 var swiper = new Swiper(‘.swiper-container‘, {
 2             effect : ‘fade‘, //效果
 3             autoplay: 2000, //自动轮播,不写为手动轮播
 4             speed:1000, //速度
 5             autoplayDisableOnInteraction: false,//停止后自动开始
 6             pagination: ‘.swiper-pagination‘, //创建小圆点
 7             nextButton: ‘.swiper-button-next‘,//上一页按钮
 8             prevButton: ‘.swiper-button-prev‘,//下一页按钮
 9             slidesPerView: 1,//定位z-index
10             paginationClickable: true,//允许鼠标拖拽
11             spaceBetween: 30, //盒子间的距离,无缝效果就是0
12             loop: true //无限循环模式
13         });
14 //鼠标移入移出控制
15 $(‘.swiper-container‘).mouseenter(function () {
16     swiper.stopAutoplay();
17 }).mouseleave(function () {
18     swiper.startAutoplay();
19 });

官网:http://www.swiper.com.cn/

  

时间: 2024-07-29 14:34:29

swiper使用心得的相关文章

Swiper 学习心得

swiper的结构为: 参数解析 1.direction:滑动方向 默认为horizontal(水平),可以设置为vertical(垂直,但在某些浏览器不好使). 2.speed:从滑动开始到滑动结束的时间,注意autoplay指的是间隔多久开始滑动. 3.autoplay:如果用户操作后autoplay停止,参考基本选项 autoplayDisableOnInteraction. 4.autoplayDisableOnInteraction:用户操作swiper之后,是否禁止autoplay.

swiper 使用心得

首先,我在这次学习的最大收益是,学习新框架.或者技术,先找官方文档比较好,那里的很全,你想要的基本都有的,如果没有那就是不支持喽. 然后简单概括下是怎么用的(比较谦虚,大家勿怪) 一 .找他的官方文档 https://swiperjs.com/demos/  点击 : Open in new window 接着右键V把源码直接放进去,在这里我就不搬过来了 二.把他的css.js 文件拷贝过来 https://swiperjs.com/package/css/swiper.min.css http

Swiper的使用心得

个人觉得:Swiper是一个好用有方便的手机端插件,但也正是因为它已经被封装好了,所有有些个性化的需求.设计不是那么好人为干预,所以在实用的时候也碰到不少头疼的问题. 下面是我在写代码的时候遇到的一些问题和解决的方法,可能解决的并不完美,存在bug,希望前辈们批评指正 1.有时候我们希望页面中显示两个或者多个swiper-slide时,设置slidesPerView属性值,默认值为1,参数是类型:number 或者 auto.如果属性值为auto的话,则是根据sildes的宽度来设置数量(不建议

Vue如何实现swiper左右滑动内容区控制导航tab同时切换高亮

Vue如何实现左右滑动内容区控制导航tab同时切换高亮,实现的效果是:点击导航按钮时内容区发生改变,左右滑动内容区时导航按钮跟随切换高亮,停留在某个内容区时刷新页面后仍然停留在当前内容区. 这里涉及到几个点: 1.左右滑动,那就需要用到swiper,当然你可以自己写一个类似的功能,虽然不难但是项目开发中可能会比你引入插件要耗时很多: 2.Vue开发鼓励组件化,所以在这我是分为nav和swiper两个组件,那么就要用到事件发射与接收,我在前面的博文有关于事件发射与接收的心得,具体点击查看: 3.利

如何运用swiper

<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"></div> <div class="swiper-slide"></div> <div class="swiper-slide"></div>

swiper 实现下拉刷新

<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>下拉刷新</title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"

第五篇、微信小程序-swiper组件

常用属性: 效果图: swiper.wxml添加代码: <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}} " bindchange="bindchangeTag"> <block wx:for="{{im

Delphi组件indy 10中IdTCPServer修正及SSL使用心得

indy 10终于随着Delphi2005发布了,不过indy套件在我的印象中总是复杂并且BUG不断,说实话,不是看在他一整套组件的面子上,我还是喜欢VCL原生的Socket组件,简洁,清晰.Indy9发展到了indy10几乎完全不兼容,可叹啊.言归正传.在使用IdTCPServer组件的时候发现了他的漏洞,他的OnConnec,OnExecute,OnDisconnect等事件是在其他线程中执行的,通常情况下这没有问题,但是在特殊的情况下会造成问题,如果其他部分的程序写得有问题就会出现漏洞.

Linux系统理解以及Linux系统学习心得

原创作品转载请注明出处  <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 作者:严哲璟 说一下我对Linux系统的理解 1.加载Linux内核准备:在加载基本输入输出模块(BIOS)之后,从磁盘的引导扇区读入操作系统的代码文件块到内存中,之后开始整个系统的初始化. 2.main.c的start_kernel函数是整个操作系统的入口,这也与Linux是基于C语言的特性相符,start_kernel具体做的动作很多