网页滚动视觉差异效果代码
代码语言:html
所属分类:视觉差异
代码描述:网页滚动视觉差异效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css?family=Open+Sans|Oswald:200");
.parallax {
position: relative;
width: 100vw;
height: 50vw;
transform-origin: bottom center;
will-change: transform;
transform: translate3d(0, calc(var(--pct) * 35%), 0) scale3d(calc(var(--pct)/2 + 1), calc(var(--pct)/2 + 1), 1);
}
.parallax div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
will-change: transform;
transform-origin: bottom center;
transform: translate3d(0, 0, 0);
}
.parallax div.p1 {
transform: translate3d(0, calc(var(--pct) * -20.0%), 0);
}
.parallax div.p2 {
transform: translate3d(0, calc(var(--pct) * -17.5%), 0);
}
.parallax div.p3 {
transform: translate3d(0, calc(var(--pct) * -15.0%), 0);
}
.parallax div.p4 {
transform: translate3d(0, calc(var(--pct) * -12.5%), 0);
}
.parallax div.p5 {
transform: translate3d(0, calc(var(--pct) * -10.0%), 0);
}
.parallax div.p6 {
transform: translate3d(0, calc(var(--pct) * -7.5%), 0);
}
.parallax div.p7 {
transform: translate3d(0, calc(var(--pct) * -5.0%), 0);
}
.parallax div.p8 {
transform: translate3d(0, calc(var(--pct) * -2.5%), 0);
}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html, body {
margin: 0;
background-color: #2b110e;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
header {
overflow: hidden;
box-shadow: inset 0 -4em 4em -4em #2b110e;
}
main {
position: relative;
z-index: 1;
min-height: 100vh;
border-top: 1px solid #3e1914;
padding: 2em 1em 4em;
max-width: 580px;
margin: 0 auto;
}
.logo {
fill: rgba(255, 255, 255, 0.3);
width: 0.72em;
vertical-align: top;
margin: 0.15em 0.15em 0.15em 0;
}
.separator {
fill: rgba(255, 255, 255, 0.1);
height: 2em;
vertical-align: top;
margin: 1em 0 0;
width: 100%;
}
h1 {
margin: 0;
font-family: Oswald;
font-size: 2em;
line-height: 1;
font-weight: 200;
color: rgba(255, 255, 255, 0.7);
}
h2 {
margin: 2em 0 0;
font-family: Oswald;
font-size: 1.6em;
line-height: 1;
font-weight: 200;
color: rgba(255, 255, 255, 0.7);
}
p, a {
font-family: Open Sans;
color: rgba(255, 255, 255, 0.7);
}
.no-iframe {
position: absolute;
top: 2em;
right: 1em;
display: none;
transition: 200ms;
z-index: 1;
font-size: 0.7em;
padding: 0.5em;
text-decoration: none;
background-color: #2b110e;
opacity: 0.5;
}
.no-iframe:hover {
opacity: 0.7;
}
</style>
</head>
<body >
<!--
Resource SVG for Parallax
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 240" style="position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;" focusable="false" aria-hidden="true">
<!-- show content using white mask fill -->
<style>mask { fill: white; }</style>
<!-- masks -->
<mask id="m1" >
<path d="M480 215.9h-3.9v3.3l-18-.7V240H480zM405 240l-.6-85.5-4.4-3.6-6.9-.7h-6.2v.5l-17.7-.5v-1h-1.3v1l-.7-.1-.6 1-4.3.1v-1l-.7-.1v-1.3l-.5-.5h-1v.8l-1.5-.1v.7l-.6-.1v-1.3l-1.3.3v1.2l-1.8-.2-3.1-.1-1.8-1.5-1.9 1.2v.7l-6.3-.1-.8-.2.4 90.4zm-181.5 0v-86.5l1-1.2h.4v-9.5h2.6v-4.5l.7-.4v-5.1l3.9-1.1h.9v-1.2h-.7v-1.3l2.8-1v-2.7l1.3-.9h5.1v2.5l.8.1 1.3.9v3.7l3.2-.2v2l.3 3.4.4.2v4.6l2.3.1.3 6.7 1.1.2v2.6l.9.1v51.1l6.3.3.7.2v10l2.3.1v6.6l.7.1v10.3h.4v9.8zm-128.8 0l1.8-1.2v-1.5h.6v-.7l2.3-1.5h.4v-2.9l.8-.9h3.6v3.6h3l8.3.4v-25.4l2.4-1.3v-6.1l1.5-.7 3.4-.9v-4l.4-.4.4-3.1h2.6v-1.5l1.1-.5h1.9v-.5h.6v-2.6h1v-.7h7.8v3l-.5.5v.7l.5.1.5.7 2.2-.2v-.3h.6v.4l.5-.1.5-.4h.3v3.7l.7.1v5.8l4.6-.3.5 15.1 1.1.2.3 23.4zM0 224.5l5.2-3.3 34.4 2.6v2.6h1.2V240H0zm267.2 15.2v-3.8l1.7-2.8h2l.3-11.8.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0