Swiper走马灯

所属分类:媒体-幻灯片和轮播图

 30261  191  查看评论 (8)
分享到微信朋友圈
X
Swiper走马灯 ie兼容9

更新时间:2020-05-10 23:28:33

使用方法

css:

img {
	width:100%;
	height:100%;
}
.swiper-container {
	width:43.75rem;
	height:10.125rem;
	margin:0 auto;
}
.swiper-container-free-mode > .swiper-wrapper {
	transition-timing-function:linear;
}

导入js cs

<link rel="stylesheet" type="text/css" href="./css/swiper.css"/>
<script src="js/jquery-1.10.2.js"></script>
<script src="js/swiper.js" type="text/javascript" charset="utf-8"></script>

body

<div class="swiper-container" id="case4">
    <div class="swiper-wrapper">
        <div class="swiper-slide"><img src="img/t1.jpg"></div>
        <div class="swiper-slide"><img src="img/t2.jpg"></div>
        <div class="swiper-slide"><img src="img/t3.jpg"></div>
        <div class="swiper-slide"><img src="img/t4.jpg"></div>
        <div class="swiper-slide"><img src="img/t5.jpg"></div>
        <div class="swiper-slide"><img src="img/t6.jpg"></div>
    </div>
    <!-- 分页器 -->
    <div class="swiper-pagination"></div>
    <!-- 滚动条 -->
    <div class="swiper-scrollbar"></div>
</div>

js:

var swiper = new Swiper('#case4', {
    loop: true, //允许从第一张到最后一张,或者从最后一张到第一张  循环属性
    slidesPerView: 4, // 设置显示三张
    //centeredSlides : true,     //使当前图片居中显示
    freeMode: true, // 使幻灯片滑动时不止滑动一格,且不会自动贴合 
    slidesPerGroup: 1, //定义1张图片为一组
    autoplay: true, //可选选项,自动滑动
    speed: 1000, //设置过度时间
    grabCursor: true, //鼠标样式根据浏览器不同而定 
    autoplay: {
        delay: 1,
        disableOnInteraction: false,
    },
    /*  设置每隔3000毫秒切换 */
    <!-- 分页器 -->
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    scrollbar: {
        el: '.swiper-scrollbar',
        hide: true,
    },
});
/* 鼠标悬停 停止动画 */
/* $('.swiper-slide').mouseenter(function () {
    swiper.autoplay.stop();
})
$('.swiper-slide').mouseleave(function () {
    swiper.autoplay.start();
})
*/
相关插件-幻灯片和轮播图

jQuery仿锤子轮播图加视差效果

一款利用css3和Jquery写的酷炫焦点图。
  幻灯片和轮播图
 30110  390

jQuery缩略图左右滑动幻灯片

一款jQuery缩略图左右滑动幻灯片
  幻灯片和轮播图
 35453  430

可嵌入图片全屏滑动

可嵌入图片视频jQuery全屏滑块
  幻灯片和轮播图
 30386  455

纯javascript仿网易轮播

这是一个用纯javascript写的仿网易轮播图效果
  幻灯片和轮播图
 34925  380

讨论这个项目(8)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    彭宏丁 0
    2020/12/11 11:20:36
    好家伙 我发现鼠标悬停的停止是根据过渡时间来的 回复
    yanyan965914478 0
    2020/6/10 16:24:48
    我用了 为啥一顿一顿的
        长安0
        2020/6/12 20:24:58
        emmmm你应该是把悬浮暂停给打开了
        长安0
        2020/6/12 20:32:45
        我发现了
        长安0
        2020/6/12 21:37:46
        你好,我这里暂时没有想出解决办法,这里有一个原生的效果(没有问题我试过了可以使用):https://blog.csdn.net/normol/article/details/77841438
    回复
    shebangs 0
    2020/6/10 11:24:14
    我说的是,vue框架,不是html内嵌vue.js,麻烦作者了 回复
    shebangs 0
    2020/6/10 11:23:22
    vue中如何使用该插件
        长安0
        2020/6/12 20:25:36
        对不起,由于作者太菜,没有用过vue所以这个我也不会
    回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复