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.8.4.7.css">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css">
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Courgette&family=Noto+Serif+Vithkuqi:wght@500&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Chonburi&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  overflow-x: hidden;
  position: relative;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

main {
  position: relative;
  min-height: 100vh;
  column-gap: 3rem;
  padding-block: min(20vh, 3rem);
  padding-inline: 2.3em;
  align-items: center;
  justify-content: center;
  background: #461356;
  overflow: hidden;
}
@media screen and (min-width: 960px) {
  main {
    display: flex;
    padding-inline: 0;
  }
}
main .content {
  width: 100%;
  color: #fff;
  position: relative;
  z-index: 2;
  margin-bottom: 3em;
}
@media screen and (min-width: 960px) {
  main .content {
    width: 40%;
    padding-left: 5em;
    margin-bottom: 0;
  }
}
main h2 {
  letter-spacing: 0.8px;
  font-weight: 700;
  font-size: 2.8rem;
  line-height: 1.2;
}
main p {
  font-size: 1rem;
  line-height: 1.8;
  margin-inline: auto;
  margin-top: 10px;
}
main .counter {
  font-weight: 400;
  display: flex;
  align-items: center;
  margin: 2.5em 0 2em 0;
  gap: 2em;
}
main .counter i {
  margin-right: 10px;
}
main .counter span {
  display: block;
  text-transform: capitalize;
  font-size: 0.8rem;
  color: #c1c1c1;
  margin-top: 3px;
}
main .btn {
  background-color: #d51a6d;
  border: none;
  color: white;
  padding: 12px 20px;
  font-size: 16px;
  cursor: pointer;
  display: inline-block;
  border-radius: 4px;
  transition: 0.3s ease-in;
}
main .btn i {
  margin-left: 15px;
}
main .btn:hover {
  background-color: #ae0a53;
}

.swiper-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  right: 0px;
  margin: 0 auto;
}
@media screen and (min-width: 960px) {
  .swiper-container {
    width: 60%;
    right: -60px;
  }
}

.swiper {
  position: relative;
  width: 100%;
  z-index: 2;
}

.swiper-slide {
  width: 10rem;
  height: 24rem;
  display: flex;
  flex-direction: column;
  align-items: self-start;
  position: relative;
  border-radius: 12px;
  box-shadow: -1px 5px 15px #0000001f;
  text-align: center;
  opacity: 0.4;
  transition: opacity 0.4s ease-in;
}
.swiper-slide span {
  display: inline-block;
  background: #9926e1;
  border-radius: 0 50px 50px 0;
  text-transform: capitalize;
  padding: 12px 20px;
  letter-spacing: 0.5px;
  font-weight: 500;
  position: absolute;
  top: 2em;
  left: 0;
  color: #fff;
}
.swiper-slide h3 {
  color: #fff;
  font-size: 1.3rem;
  line-height: 1.4;
  margin-bottom: 0.625rem;
  letter-spacing: 0.8px;
  position: relative;
  word-wrap: break-word;
}
@media screen and (min-width: 800px) {
  .swiper-slide h3 {
    font-size: 1.8rem;
  }
}
.swiper-slide p {
  color: #fff;
  line-height: 1.6;
  font-size: 0.8rem;
}
.swiper-slide .slide-content {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, -10px);
  width: 90%;
}
.swiper-slide--one {
  background: #0f2027;
  background: linear-gradient(to bottom, #2c536400, #203a4303, #0f2027cc), url("//repo.bfw.wiki/bfwrepo/image/5fc1af0ba6cc8.png") no-repeat 50% 50%/cover;
}
.swiper-slide--one h3 {
  font-family: "Courgette", cursive;
  font-weight: 300;
}
.swiper-slide--two {
  background: linear-gradient(to bottom, #2c536400, #203a4303, #0f2027cc), url("//repo.bfw.wiki/bfwrepo/image/5fe1bc8e0ed82.png") no-repeat 50% 50%/cover;
}
.swiper-slide--two h3 {
  font-family: "Noto Serif Vithkuqi", serif;
  font-weight: 300;
}
.swiper-slide--three {
  background: url("//repo.bfw.wiki/bfwrepo/image/5fc1afe38993c.png") no-repeat 50% 50%/cover;
}
.swiper-slide--four {
  background: url("//repo.bfw.........完整代码请登录后点击上方下载按钮下载查看

网友评论0