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/all.6.5.1.css">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/swiper-bundle.11.0.4.css">
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300..700&family=Salsa&display=swap");

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: #232328;
  font-family: "Quicksand", sans-serif;
}

.swiper-container {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.swiper-slide {
  position: relative;
  width: 100%;
  height: 100vh;
}

/* content */

.content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  top: 14%;
  left: 3%;
  width: 40%;
  height: max-content;
  color: #f2f2f2;
  text-align: center;
  padding: 20px;
  opacity: 0;
  z-index: 2;
}

.content h1 {
  font-family: "Salsa", cursive;
  font-size: clamp(2rem, 3vw, 6rem);
  margin-bottom: 20px;
  opacity: 0;
}

.content p {
  font-family: inherit;
  font-size: 1.2rem;
  line-height: 1.4;
  font-weight: 500;
  opacity: 0;
}

.swiper-slide-active .content {
  opacity: 1;
}

.swiper-slide-active .content h1 {
  animation: moveDown 0.8s ease-in forwards;
}

.swiper-slide-active .content p {
  animation: moveDown 1s ease-in forwards;
  animation-delay: 1s;
}

@keyframes moveDown {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* background */

.background[data-item="one"] {
  background: url(//repo.bfw.wiki/bfwrepo/image/6544b7fcd69c6.png);
  background-size: cover;
  background-position: 50% 40%;
}

.background[data-item="two"] {
  background: url(.........完整代码请登录后点击上方下载按钮下载查看

网友评论0