css - How do I trigger this page transition using jquery? -


http://www.biola.me/

i'd similar transition effect when clicked in "about" link. i've seen code , uses css transition , transform. how trigger jquery?

thanks in advance

here way it:

css:

html, body {     height: 100%; }  .nav > li {     list-style: none;     cursor: pointer; }  .nav > li > {     font-size: 24px; }  .container {     overflow-x: hidden;     -webkit-transition: -webkit-transform 0.5s;     transition: transform 0.5s; }     .container.overlay-open {     -webkit-transform: translatex(100%);     transform: translatex(100%); }  .overlay {     position: fixed;     width: 100%;     height: 100%;     top: 0;     left: 0;     background: rgba(153,204,51,0.9);     overflow-y: scroll; }     .overlay .close {     position: absolute;     top: 15px;     right: 15px;     color: #ffffff;     font-size: 21px;     cursor: pointer; }  .overlay-contentpush {     visibility: hidden;     -webkit-backface-visibility: hidden;     backface-visibility: hidden;     -webkit-transform: translatex(-100%);     transform: translatex(-100%);     -webkit-transition: -webkit-transform 0.5s, visibility 0s 0.5s;     transition: transform 0.5s, visibility 0s 0.5s; }     .overlay-contentpush.open {     visibility: visible;     -webkit-transform: translatex(0%);     transform: translatex(0%);     -webkit-transition: -webkit-transform 0.5s;     transition: transform 0.5s; } 

html:

<div class="container">     <ul class="nav">         <li>             <a data-trigger="about">about</a>         </li>         <li>             <a data-trigger="contact">contact</a>         </li>     </ul> </div>  <section class="overlay overlay-contentpush" id="home"></section>  <section class="overlay overlay-contentpush" id="about">     <div class="close">         close     </div> </section>  <section class="overlay overlay-contentpush" id="contact">     <div class="close">         close     </div> </section> 

js:

// trigger overlay $("[data-trigger='about']").click(function() {     $(".container").addclass("overlay-open");     $("#about").addclass("open"); }); $("[data-trigger='contact']").click(function() {     $(".container").addclass("overlay-open");     $("#about").addclass("open"); }); // close overlay $(".close").click(function() {     $(".container").removeclass("overlay-open");     $(".overlay").removeclass("open"); }); 

codepen:

http://codepen.io/charliebeckstrand/pen/wxnjme


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -