首页 > 其他分享 >Swiper横向循环焦点图片展示

Swiper横向循环焦点图片展示

时间:2023-10-07 14:44:08浏览次数:30  
标签:展示 certify 横向 width slide Swiper background swiper slideProgress


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Swiper的切换</title>
  <link rel="stylesheet" href="css/swiper.min.css">
  <link rel="stylesheet" href="css/certify.css">
  <script src="js/swiper.min.js"></script>

</head>
<body>
<div id="certify">
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide"><img src="images/1.jpg" /></div>
      <div class="swiper-slide"><img src="images/2.jpg" /></div>
      <div class="swiper-slide"><img src="images/3.jpg" /></div>
      <div class="swiper-slide"><img src="images/4.jpg" /></div>
      <div class="swiper-slide"><img src="images/5.jpg" /></div>
    </div>
  </div>
  <div class="swiper-pagination"></div>
  <div class="swiper-button-prev"></div>
  <div class="swiper-button-next"></div>
</div>

<script>
  certifySwiper = new Swiper('#certify .swiper-container', {
    watchSlidesProgress: true,
    slidesPerView: 'auto',
    centeredSlides: true,
    loop: true,
    loopedSlides: 5,
    autoplay: true,
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },

    on: {
      progress: function(progress) {
        for (i = 0; i < this.slides.length; i++) {
          var slide = this.slides.eq(i);
          var slideProgress = this.slides[i].progress;

          if (Math.abs(slideProgress) > 1) {
            modify = (Math.abs(slideProgress) - 1) * 0.4 + 1;
          }
          translate = slideProgress * modify * 318 + 'px';
          scale = 1 - Math.abs(slideProgress) / 5;
          zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
          slide.transform('translateX(' + translate + ') scale(' + scale + ')');
          slide.css('zIndex', zIndex);
          slide.css('opacity', 1);
          if (Math.abs(slideProgress) > 3) {
            slide.css('opacity', 0);
          }
        }
      },
      setTransition: function(transition) {
        for (var i = 0; i < this.slides.length; i++) {
          var slide = this.slides.eq(i)
          slide.transition(transition);
        }

      }
    }

  })
</script>
</body>
</html>
@charset "utf-8";
/* CSS Document */
body{
    margin:0;}
#certify {
    position: relative;
    width: 1123px;/*判断宽度设置响应式效果*/
    margin: 60px auto
}

#certify .swiper-container {
    padding-bottom: 60px;
}

#certify  .swiper-slide {
    width: 641px;
    height: 347px;
    background: #fff;
    border:1px solid #c2c2c2;
}
#certify  .swiper-slide img{
    width: 637px;
    height: 343px;
    display:block;
    border:2px solid #fff;
}

#certify .swiper-pagination {
    width: 100%;
    bottom: 20px;
}

#certify .swiper-pagination-bullets .swiper-pagination-bullet {
    margin: 0 5px;
    border: 3px solid #fff;
    background-color: #d5d5d5;
    width: 10px;
    height: 10px;
    opacity: 1;
}

#certify .swiper-pagination-bullets .swiper-pagination-bullet-active {
    border: 3px solid #00aadc;
    background-color: #fff;
}

#certify .swiper-button-prev {
    left: 140px;
    width: 60px;
    height: 111px;
    top:133px;
    background: url(../images/lunbo_17.png) no-repeat;

    background-size: 100%;
}

#certify .swiper-button-prev:hover {
    /*background-position: 0 -46px;*/
    /*background-size: 100%*/
}

#certify .swiper-button-next {
    right: 140px;
    width: 60px;
    height: 111px;
    top:133px;
    background: url("../images/lunbo_20.png") no-repeat;

    background-size: 100%;
}

#certify .swiper-button-next:hover {
    /*background-position: 0 -139px;*/
    /*background-size: 100%*/
}

标签:展示,certify,横向,width,slide,Swiper,background,swiper,slideProgress
From: https://www.cnblogs.com/photo520/p/17746264.html

相关文章

  • c# 用SapNwRfc调用sap内置bom函数用TreeView把bom展示出来
    一个需求,winform根据料号,查询sap 的bom,然后用控件调用sap内置bom函数,根据料号查询bom用TreeView把bom展示出来树形控件TreeView展示出来,TreeView的好处是父级子级直观明了。sap关于bom 的tcode 主要是cs11,cs12,cs13。cs12可以显示多级bom,查询出来是这样的: 这种表现方式,不是......
  • 内网横向移动
    内网横向移动常用Windows远程连接和相关命令1.IPC1)建立连接netuse\\192.168.162.140\ipc$/user:Administratorhongrisec@2019在命令行中输入netuse查看当前连接2)ipc$的利用条件a)开启了139,445端口b)管理员开启了默认共享3)ipc$连接失败的原因a)用户名密码错......
  • 以下是一个复杂的 C 语言代码示例,展示了如何使用递归函数来计算斐波那契数列: ```c #i
    以下是一个复杂的C语言代码示例,展示了如何使用递归函数来计算斐波那契数列:#include<stdio.h>//递归函数计算斐波那契数列intfibonacci(intn){if(n<=1){returnn;}returnfibonacci(n-1)+fibonacci(n-2);}intmain(){intnum;......
  • 安防监控/视频汇聚平台EasyCVR云端录像不展示是什么原因?该如何解决?
    视频云存储/安防监控EasyCVR视频汇聚平台基于云边端智能协同,支持海量视频的轻量化接入与汇聚、转码与处理、全网智能分发、视频集中存储等。音视频流媒体视频平台EasyCVR拓展性强,视频能力丰富,具体可实现视频监控直播、视频轮播、视频录像、云存储、回放与检索、智能告警、服务器集......
  • 关闭页面展示,运行selenium
    #关闭浏览器展示模式判断元素是否存在#导包fromseleniumimportwebdriverfromselenium.webdriver.common.byimportByfromtimeimportsleepfromselenium.webdriver.chrome.optionsimportOptions#定义类classGetEle:def__init__(self,driver):......
  • filebeat 收集 nginx 日志到 kibana 展示
    首先是nginx.conf的日志格式json格式很多,不一定非要这个log_formatjson'{"access_time":"$time_iso8601","remote_addr":"$remote_addr","remote_user":"$remote_user","request":"$request&qu......
  • 直播平台制作,SwipeRefreshLayout下拉刷新的用法
    直播平台制作,SwipeRefreshLayout下拉刷新的用法布局 <?xmlversion="1.0"encoding="utf-8"?><LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools"  x......
  • DNA重组--团队展示
    队名:DNA重组团队项目描述:谁不想用电脑摸鱼的时候上网页点个外卖呢?所以我们做了网页外卖平台。队员风采:学号:2023021871成员姓名:周佳宁博客园地址:https://www.cnblogs.com/t-travel/性格:开朗、乐观擅长的技术:java后端、web前端角色:后端宣言:“一起来面向对象写bug吧。” 学号:2023......
  • 毛毛虫——团队展示
    团队介绍1.团队名称:毛毛虫2.团队项目描述:操作简单的管理系统3.团队口号:在前进中曲折,在曲折中前进!4.团队成员介绍学号:2023021850昵称:科科博客地址:https://www.cnblogs.com/csk666/性格:开朗技术:Java、html兴趣爱好:游戏、听音乐希望的软工角色:后端、前端宣言:积极乐观......
  • 吴彦组——团队展示
    吴彦组——团队展示队名:吴彦组起这个队名是我们都认为自己长得帅,而且 "彦"在古文中也有"才子"的意思,这可能表示这个团队希望寻找或培养有才华的人,或者他们希望以卓越的才能和智慧来实现目标。拟作的团队项目描述:Greatprojectsarenotaboutsize,butaboutpersevera......