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>
* {
  margin : 0;
  padding : 0;
  box-sizing : border-box;
}

body {
  display : grid;
  place-items : center;
  min-height : 100svh;
  background: #eee;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

.swiper {
  width: 100%;
  height: 100%;
}

.swiper-wrapper {
    display: flex;
    align-items: center;
}

.swiper-slide {
  scale : 1.25;
  transition : scale 250ms ease-in-out;
  
  &.swiper-slide-active {
    scale : 2;
    z-index : 10;
  }
  
  &.swiper-slide-prev,
  &.swiper-slide-next {
    scale : 1.7;
    z-index : 5;
    transition-duration: 150ms;
  }
}

.swiper-slide img {
  display: block;
  border-radius : 0.5rem;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select : none;
}

.swiper-button {
  background-color: #F04E23;
  height: 3rem;
  width: 3rem;
  border-radius : 0.25rem;
  left : 50%;
  translate: -425px;
  
  &.swiper-button-next {
    left : initial;
    right : 50%;
    translate: 425px;
  }
  
  &:hover {
    background-color: #4A261F;
  }
  
  &::after {
    font-size : 1.5rem;
    color : white;
  }
}
</style>


  
  
</head>

<body translate="no">
  <!-- Swiper -->
<div class="swiper">
  <div class="swiper-wrapper">
    <div class="swiper-slide">
      <img src="//repo.bfw.wiki/random/800x600/景色?rand=1" />
    </div>
    <div class="swiper-slide">
      <img src="//repo.bfw.wiki/random/800x600/景色?rand=12" />
    </div>
    <div class="swiper-slide">
      <img src="https://images.unsplash.com/photo-1670414701148-16ac8873a150?q=80&w=2648&auto=format&fit=crop&ixl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0