TweenMax实现水平拖拽大气相册幻灯片轮播图效果代码
代码语言:html
所属分类:幻灯片
代码描述:TweenMax实现水平拖拽大气相册幻灯片轮播图效果代码
代码标签: TweenMax 拖拽 水平 幻灯片 轮播图 相册
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> @font-face { font-family: 'font'; src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/58281/https://s3-us-west-2.amazonaws.com/s.cdpn.io/58281/OakesGrotesk-Semi-Bold.woff.woff2") format("woff2"); src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/58281/https://s3-us-west-2.amazonaws.com/s.cdpn.io/58281/OakesGrotesk-Semi-Bold.woff.woff2") format("woff"); font-weight: normal; font-style: normal; } html, body { height: 100%; font-family: 'helvetica neue'; } body { height: 100%; overflow-y: scroll; padding: 0; margin: 0; background-color: #111; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } h1, h2 { font-weight: normal; } * { box-sizing: border-box; } figure { padding: 0; margin: 0; } .scroll { cursor: -webkit-grab; cursor: grab; } .scroll-content { display: flex; white-space: nowrap; position: relative; height: 100vh; } .scroll-content--last { position: absolute; top: 0; left: 0; } .hi { position: fixed; bottom: 2vw; left: 2vw; color: #fff; font-size: 1vw; z-index: 999; text-decoration: none; } .logo { position: relative; } .logo--top { position: fixed; top: 2vw; left: 2vw; z-index: 10; } .logo--top img { height: 1vw; width: auto; } .logo--resize { margin-bottom: 1rem; } .logo--resize img { width: 10rem; margin: 0 auto; } .logo--mask { overflow: hidden; margin-bottom: 2rem; } .logo--mask img { width: 15rem; height: auto; margin: 0 auto; visibility: hidden; opacity: 0; } .menu-btn { position: fixed; top: 2vw; right: 2vw; display: flex; align-items: center; text-decoration: none; z-index: 999; } .menu-btn__circles { position: relative; height: 0.45vw; width: 0.45vw; margin-right: 0.75vw; } .menu-btn__circle { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #fff; border-radius: 50%; } .menu-btn__circle--top { visiblity: hidden; opacity: 0; } .menu-btn__text { color: #fff; font-size: 1vw; } .filter { position: absolute; top: 7.5%; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); z-index: 10; } .filter__list { display: flex; } .filter__item { display: block; } .filter__link { position: relative; display: block; color: rgba(255, 255, 255, 0.5); text-decoration: none; padding: 0 1.5vw; font-size: 1.15vw; overflow: hidden; } .filter__link-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; background-color: #111; -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); transition: -webkit-transform .75s ease; transition: transform .75s ease; transition: transform .75s ease, -webkit-transform .75s ease; z-index: 2; } .filter__link-mask span { display: block; padding: 0 1.5vw; font-size: 1.15vw; -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); transition: -webkit-transform .75s ease; transition: transform .75s ease; transition: transform .75s ease, -webkit-transform .75s ease; color: #fff; } .filter__link:hover .filter__link-mask span, .filter__link.is-active .filter__link-mask span { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .filter__link:hover .filter__link-mask, .filter__link.is-active .filter__link-mask { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .slide { display: flex; width: 50vw; height: 100%; padding: 20vh 0; } .slide--1 { align-items: flex-start; } .slide--2 { align-items: flex-end; } .slide--3 { align-items: center; } .slide:last-child { width: 65vw; padding-right: 15vw; } .slide__inner { position: relative; padding-left: 15vw; width: 100%; } .slide__sub-title { position: absolute; top: 15%; left: 5vw; color: rgba(255, 255, 255, 0.5); font-size: 1vw; } .slide__title { position: absolute; top: 7.5%; left: 7.5vw; color: #fff; font-size: 4vw; z-index: 2; overflow: hidden; } .slide__project { color: #fff; position: absolute; top: 100%; right: 5%; font-size: 1.15vw; padding-top: 1.5vw; } .slide__img { position: relative; overflow: hidden; padding-top: 65%; width: 100%; } .slide__img figure { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .slide__img figure img { position: absolute; top: 0; left: 0; height: 100%; width: 100%; -o-object-fit: cover; object-fit: cover; } img { display: block; width: 100%; height: auto; } .scrollbar { position: absolute; bottom: 7.5%; left: 20%; right: 20%; height: 1px; background-color: rgba(255, 255, 255, 0.25); } .scrollbar__handle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-transform: scaleX(0); transform: scaleX(0); -webkit-transform-origin: left; transform-origin: left; background-color: #fff; } .mask { display: flex; flex-direction: column; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; visibility: hidden; opacity: 0; } .mask__slice { flex: 1; background-color: #000; } .mask__inner { position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); } .mask-line { position: relative; -webkit-transform-origin: left; transform-origin: left; width: 20rem; height: 2px; overflow: hidden; background-color: rgba(255, 255, 255, 0.25); visibility: hidden; opacity: 0; } .mask-line__inner { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #fff; -webkit-transform-origin: left; transform-origin: left; } .resize { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 9999; } .resize__inner { position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); color: #fff; text-align: center; text-decoration: none; } .resize span { color: rgba(255, 255, 255, 0.5); } @media (max-width: 800px) { .resize { display: block; } } @media (max-height: 600px) { .resize { display: block; } } </style> </head> <body> <figure class="logo logo--top js-trigger"> <img src="//repo.bfw.wiki/bfwrepo/icon/617246072af45.png"> </figure> <a href="" target="_blank" class="resize"> <div class="resize__inner"> <figure class="logo logo--resize"> <img src="//repo.bfw.wiki/bfwrepo/icon/617246072af45.png"> </figure> <p>Please view in <span>full page</span> mode</p> </div> </a> <a href="" target="_blank" class="hi"> Hi </a> <a href="" target="_blank" rel="nofollow" class="menu-btn js-menu-btn"> <div class="menu-btn__circles"> <span class="menu-btn__circle menu-btn__circle--top js-menu-btn__circle--top"></span> <span class="menu-btn__circle menu-btn__circle--bottom js-menu-btn__circle--bottom"></span> </div> <div class="menu-btn__text">See shot</div> </a> <div class="scroll" data-scroll> <nav class="filter"> <ul class="filter__list"> <li class="filter__item"> <a href="#" class="filter__link is-active js-trigger"> <div class="filter__link-mask" area-hidden><span>Interiors</span></div> Interiors </a> </li> <li class="filter__item"> <a href="#" class="filter__link js-trigger"> <div class="filter__link-mask" area-hidden><span>Residential</span></div> Residential </a> </li> <li class="filter__item"> <a href="#" class="filter__link js-trigger"> <div class="filter__link-mask" area-hidden><span>Commercial</span></div> Commercial </a> </li> <li class="filter__item"> <a href="#" class="filter__link js-trigger"> <div class="filter__link-mask" area-hidden><span>Installation</span></div> Installation </a> </li> </ul> </nav> <div class="scroll-content" data-scroll-content> <article class="slide slide--1 js-slide"> <div class="slide__inner"> <div class="slide__img js-transition-img"> <figure class="js-transition-img__inner"> <img src="//repo.bfw.wiki/bfwrepo/image/5e1c022531682.png" draggable="false"> </figure> </div> </div> </article> <article class="slide slide--2 js-slide"> <div class="slide__inner"> <div class="slide__img js-transition-img"> <figure class="js-transition-img__inner"> <img src="//repo.bfw.wiki/bfwrepo/image/5e323253cf4d2.png" draggable="false"> </figure> </div> </div> </article> <article class="slide slide--3 js-slide"> <div class="slide__inner"> <div class="slide__img"> <figure> <img src="//repo.bfw.wiki/bfwrepo/image/5e3632bed9568.png" draggable="false"> </figure> </div> </div> </article> <article class="slide slide--1 js-slide"> <div class="slide__inner"> <div class="slide__img"> <figure> <img src="//repo.bfw.wiki/bfwrepo/image/5e68316809f5a.png" draggable="false"> </figure> </div> </div> </article> <article class="slide slide--2 js-slide"> <div class="slide__inner"> <div class="slide__img"> <figure> <img src="//repo.bfw.wiki/bfwrepo/image/5e957a2236f31.png" draggable="false"> </figure> </div> </div> </article> <article class="slide slide--3 js-slide"> <div class="slide__inner"> <div class="slide__img"> <figure> <img src="//repo.bfw.wiki/bfwrepo/image/5fc1a9b3bd22e.png" draggable="false"> </figure> </div> </div> </article> </div> <div class="scroll-content scroll-content--last" data-scroll-content> <article class="slide slide--1 js-slide"> <div class="slide__inner"> <div class="slide__sub-title"><span>Project</span></div> <h1 class="slide__title"><div class="js-transition-title">Oak Refuge</div></h1> <div class="slide__img slide__img--proxy"></div> <div class="slide__project">Corpus Studio</div> </div> </article> .........完整代码请登录后点击上方下载按钮下载查看
网友评论0