JSFiddle - React, Tailwind, and code Playground

by trolleymusic

HTML

<div id="main" class="page-1">
<div id="page-1">
    <form><input id="search-1" autocomplete="off"></form>
</div>
<div id="page-2">Content from second page</div>
</div>

CSS

div#main {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    background: url(http://sitedev-bw.sapient.com/assets/img/bg-4.jpg) no-repeat;
    background-position-x: 50%;
    background-position-y: 100%;
}

.page-1 {
    background-position: 50% 100%;
}

.transition, .page-2 {
    background-position: 50% 0!important;
}

@-webkit-keyframes bgmove {
    0% { background-position-y: 100%; }
    100% { background-position-y: 0; }
}

@-moz-keyframes bgmove {
    0% { background-position-y: 100%; }
    100% { background-position-y: 0; }
}

.transition {
    -webkit-animation: bgmove 4s 1;
    -moz-animation: bgmove 4s 1;
}

#page-1 {
    -webkit-transition: all 0.7s ease-in;
    -moz-transition: all 0.7s ease-in;
}

#page-2 {
    -webkit-transition: all 0.5s ease-out;
    -moz-transition: all 0.5s ease-out;
}

#page-1, #page-2 {
    line-height: 100px;
    text-align: center;
    display: block;
    position: absolute;
    top: 100px;
    left: 100px;
    right: 100px;
    bottom: 100px;
    background: rgba(16,16,16,0.6);
}

#page-2 {
    background: rgba(171,156,143,0.85);
}

.transition #page-1 {
    display: block;        
    top: 110%;
    bottom: -90%;
}

.page-2 #page-1, .page-1 #page-2 {
    display: none;
}

.transition #page-2 {
    display: block;
    top: 100%;
    bottom: -100%;
}

.page-2 #page-2 {
    display: block;
    top: 100px;
    bottom: 100px;
}

#search-1 {
    display: block;
    margin: 20px auto;
    width: 80%;
    background: rgba(255,255,255,0.1);
    border: none;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 30px;
    color: white;
}

JavaScript

$(document).ready(function(){
    
    $('#search-1').focus();
    
    $('form').submit(function(e) {
        e.preventDefault();
        $('#search-1').blur();
        $('#main').addClass('transition');
        setTimeout(function() { $('#main').addClass('page-2').removeClass('page-1 transition'); }, 4000)
    })
    
    /*setTimeout(function() {  }, 2000)
    */
});