纯css实现的视觉差滚动效果

代码语言:html

所属分类:视觉差异

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title>No JS Parallax</title>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto+Slab'>
<style>
      :root {
  font-family: 'Roboto', sans-serif;
}

h1,h2,h3,h4,h5,h6 {
  font-family: "Roboto Slab", serif;
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background: white;
  margin: 0;
  padding: 0;
  height: 100%;
  transform-style: preserve-3d;
  perspective: 1px;
  overflow-y: scroll;
  overflow-x: hidden;
}

.parallax {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5vw;
  transform-style: inherit;
  box-sizing: border-box;
  overflow: hidden;
}

.parallax, .parallax::after {
  background: 50% 50% / cover;
}

.parallax::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: block;
  background: url(https://franknoirot.co/assets/img/furniture/5.jpg);
  background-size: cover;
  transform-origin: 50% 50% 0;
  transform: translateZ(-1px)  scale(2);
  z-index: -1;
  min-height: 100vh;
}

.img-2::after { background: url(https://franknoirot.co/assets/img/furniture/6.jpg); }
.img-3::after { background: url(https://franknoirot.co/assets/img/furniture/1.jpg); }

.paralkax * {
  filter: drop-shadow(0 .2em ..05em rgba(50,50,50,0.2));
}

section:not(.parallax) {
  background: white;
  box-sizing: border-box;
  padding: 5vmin 5vw;
  min-height: 100vh;
}




/* Share badge styles */
.social-badge {
  --twitter-primary:#55acee;
  --twitter-dark: #292f33;
  --twitter-light: #e1e8ed.........完整代码请登录后点击上方下载按钮下载查看

网友评论0