视觉差异滚动特效页面
代码语言:html
所属分类:视觉差异
代码描述:视觉差异滚动特效页面
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Inknut+Antiqua:600|Roboto|Roboto+Condensed:700'> <style> *, *:before, *:after { margin: 0; padding: 0; box-sizing: border-box; } html, body { width: 100%; height: 100%; overflow: hidden; } .content { height: 100%; overflow-x: hidden; overflow-y: auto; -webkit-clip-path: border-box; clip-path: border-box; -webkit-transform: translateZ(0); transform: translateZ(0); } .block { position: relative; height: 100vh; } [class*='item-parallax'] { position: absolute; width: 100%; height: 100%; -webkit-transition: -webkit-transform 0.3s ease-out; transition: -webkit-transform 0.3s ease-out; transition: transform 0.3s ease-out; transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out; will-change: transform; } .item-parallax-media { z-index: 1; } .item-parallax-media img { will-change: transform; } .item-parallax-content { z-index: 2; } .block:nth-child(1) .item-parallax-content { -webkit-transform: translateY(calc( var(--yBlock-1) * 0.5px )); transform: translateY(calc( var(--yBlock-1) * 0.5px )); } .block:nth-child(1) .item-parallax-media img { -webkit-transform: translateY(calc( var(--yBlock-1) * 0.1px )); transform: translateY(calc( var(--yBlock-1) * 0.1px )); } .block:nth-child(2) .item-parallax-content { -webkit-transform: translateY(calc( var(--yBlock-2) * 0.5px )); transform: translateY(calc( var(--yBlock-2) * 0.5px )); } .block:nth-child(2) .item-parallax-media img { -webkit-transform: translateY(calc( var(--yBlock-2) * 0.1px )); transform: translateY(calc( var(--yBlock-2) * 0.1px )); } .block:nth-child(3) .item-parallax-content { -webkit-transform: translateY(calc( var(--yBlock-3) * 0.5px )); transform: translateY(calc( var(--yBlock-3) * 0.5px )); } .block:nth-child(3) .item-parallax-media img { -webkit-transform: translateY(calc( var(--yBlock-3) * 0.1px )); transform: translateY(calc( var(--yBlock-3) * 0.1px )); } .block:nth-child(4) .item-parallax-content { -webkit-transform: translateY(calc( var(--yBlock-4) * 0.5px )); transform: translateY(calc( var(--yBlock-4) * 0.5px )); } .block:nth-child(4) .item-parallax-media img { -webkit-transform: translateY(calc( var(--yBlock-4) * 0.1px )); transform: translateY(calc( var(--yBlock-4) * 0.1px )); } .block:nth-child(5) .item-parallax-content { -webkit-transform: translateY(calc( var(--yBlock-5) * 0.5px )); transform: translateY(calc( var(--yBlock-5) * 0.5px )); } .block:nth-child(5) .item-parallax-media img { -webkit-transform: translateY(calc( var(--yBlock-5) * 0.1px )); transform: translateY(calc( var(--yBlock-5) * 0.1px )); } html { background-color: #00171f; } .flex-container { display: -webkit-box; display: flex; } .centered-content { margin: auto; } .head-large { margin-bottom: 5vw; font-size: 10vw; line-height: 1.2em; font-family: 'Inknut Antiqua', serif; color: white; } .head-small { margin-bottom: 1.5rem; font-size: 1.2rem; line-height: 1.2em; font-family: 'Roboto Condensed', sans-serif; color: white; text-transform: uppercase; letter-spacing: 0.5em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .head-centered { text-align: center; } .copy { display: block; max-width: 500px; margin-right: auto; margin-bottom: 1.5rem; margin-left: auto; padding-right: 1.5rem; padding-left: 1.5rem; font-family: 'Roboto', sans-serif; font-size: 1rem; line-height: 1.8em; text-align: center; } .copy-white { color: white; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .item-parallax-media { overflow: hidden; } .item-parallax-media img { position: absolute; top: -10%; left: -10%; width: 120%; height: 120%; -o-object-fit: cover; object-fit: cover; } .section-landing:before { content: ''; position: absolute; top: 50%; left: 24%; width: 10px; height: 80%; background-color: white; z-index: 3; -webkit-transform: translateY(-13vw); transform: translateY(-13vw); } .section-landing .item-parallax-media { opacity: calc( 1 - (var(--y) * 0.0009) ); } .landing-content { padding-left: 30%; } .section-intro:before { content: ''; position: absolute; top: 50%; left: 50%; width: 10px; height: 80%; background-color: #0d232a; -webkit-transform: translateX(-50%) translateY(-50%) rotate(calc( (var(--y) * 0.1deg) )); transform: translateX(-50%) translateY(-50%) rotate(calc( (var(--y) * 0.1deg) )); will-change: transform; -webkit-backface-visibility: visible; backface-visibility: visible; } .img-grid { -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; justify-content: space-around; } .img-gridItem { position: relative; width: 100%; max-width: 800px; margin-right: auto; margin-left: auto; } .img-gridItem img { display: block; width: 50%; height: 40vh; -o-object-fit: cover; object-fit: cover; will-change: transform; -webkit-backface-visibility: visible; backface-visibility: visible; } .img-gridItem.type-left img { margin-right: auto; } .img-gridItem.type-right img { margin-left: auto; } .img-gridItem:nth-child(1) img { -webkit-trans.........完整代码请登录后点击上方下载按钮下载查看
网友评论0