swiper实现立方体可拖拽幻灯片切换效果代码

代码语言:html

所属分类:幻灯片

代码描述:swiper实现立方体可拖拽幻灯片切换效果代码

代码标签: swiper 立方体 拖拽 幻灯片 切换

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/swiper-bundle.11.0.4.css">
  
<style>


.cube-parent-container {
  width: 100%;
  max-width: 600px;
  margin: 0;
}

/*  Aspect ratio as 1/1 or square */

.cubeSwiper .swiper-slide {
  aspect-ratio: 1/1;
}

/*  Set slide image to cover */

.cubeSwiper .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*  Pagination as three column grid  */
.cubeSwiper .pagination-container {
  padding-top: 25px;
  /*  pagination grid container width set in absolute pixels as using 
      transform scale for responsiveness.  */
  width: 250px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  grid-template-rows: 1fr;
  grid-column-gap: 0px;
  grid-row-gap: 0px;

  /* Scale down pagination - i.e. bigger or smaller at your break points */
  transform: scale(0.8);
}

/* fraction/slide count */

.cubeSwiper .cube-pagination-fraction {
  color: rgba(255, 0, 255, 0.8);
  font-size: 18px;
  font-weight: 700;
  margin-top: 15px;
  text-align: center;
  position: relative;
}

/* prev/next buttons */

.cube-button-prev,
.cube-button-next {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  transition: all 500ms ease;
  filter: brightness(0.8);
  letter-spacing: 1px;
  font-weight: 700;
}

.cube-button-prev:hover,
.cube-button-next:hover {
  color: red;
  filter: brightness(0.95);
}

body {
  background: black;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: white;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  height: 100vh;
}
</style>


  
</head>

<body >
  <figure class="cube-parent-container"> 
  
  <!-- Swiper -->
  <div class="swiper cubeSwiper">
    <div class="swiper-wrapper">
      
       <!-- begin slides -->
      
      <div class="swiper-slide"> <img alt="Hail Barkus!" src="//repo.bfw.wiki/bfwrepo/image/61c930f90c867.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_600,h_600,/quality,q_90" /> </div>
      
      <div  class="swiper-slide"> <img alt="Hail Barkus!" src="//repo.bfw.wiki/bfwrepo/imag.........完整代码请登录后点击上方下载按钮下载查看

网友评论0