JSFiddle - React, Tailwind, and code Playground
by Keith Jeter
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenLite.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TimelineMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/plugins/CSSPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/easing/EasePack.min.js"></script>
<script src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
<div id="all-container" class="container">
<div id="phone" class="container">
<div id="header">
<div id="header-photo" class="header-el">
<i class="fa fa-camera fa-2x el"></i>
</div>
<div id="header-people" class="header-el">
<i class="fa fa-user fa-2x el"></i>
</div>
<div id="header-mex" class="header-el">
<i class="fas fa-comments el"></i>
</div>
<div id="header-heart" class="header-el">
<i class="fas fa-heart el"></i>
</div>
<div id="header-bg"></div>
<div id="menu-icon" class="menu-icon">
<i class="fas fa-bars"></i>
</div>
<div id="menu-icon-x" class="menu-icon">
<i class="fas fa-arrow-left"></i>
</div>
</div> <!-- header -->
<div id="el-home-box">
<div class="el-home-01 el-home el-home-anima"></div>
<div class="el-home-02 el-home el-home-anima"></div>
<div class="el-home-02 el-home el-home-anima"></div>
<div class="el-home-03 el-home el-home-anima"></div>
<div class="el-home-03">
<div class="el-home-01 el-home el-home-anima"></div>
<div class="el-home-01 el-home el-home-anima"></div>
</div>
</div>
</div>
</div>
<!-- -->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
<feColorMatrix...
CSS
body {
background-color: #52206d;
margin: 0;
padding: 0;
}
.container {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
#all-container {
border-radius: 5px;
height: 600px;
width: 600px;
}
#phone {
/* background-color: whitesmoke; */
border-radius: 5px;
box-shadow: 10px 10px 30px rgba( 0, 0, 0, 0.5);
height: 280px;
overflow: hidden;
width: 300px;
}
/* ////////////////////////////////////// header background ///// */
#header {
position: relative;
z-index: 99;
filter: url('#goo');
}
#header-bg {
animation-fill-mode: both;
height: 60px;
position: absolute;
width: 100%;
}
.header-bg {
animation-name: header-bg;
animation-duration: 0.4s;
}
@keyframes header-bg {
100% {background-color: #fff;}
}
.header-bg-photo {
animation-name: header-bg-photo;
animation-duration: 0.4s;
}
@keyframes header-bg-photo {
100% {background-color: #2E92ED;}
}
.header-bg-people {
animation-name: header-bg-people;
animation-duration: 0.4s;
}
@keyframes header-bg-people {
100% {background-color: #21C49B;}
}
.header-bg-mex {
animation-name: header-bg-mex;
animation-duration: 0.4s;
}
@keyframes header-bg-mex {
100% {background-color: #F0BE11;}
}
.header-bg-heart {
animation-name: header-bg-heart;
animation-duration: 0.4s;
}
@keyframes header-bg-heart {
100% {background-color: #DF681A;}
}
/* ////////////////////////////////////// header icon menu ///// */
.menu-icon {
cursor: pointer;
left: 15px;
opacity: 1;
position: absolute;
top: 30px;
transform: translateY(-50%);
transition: 0.2s ease-in-out;
}
.menu-icon-in {
opacity: 1;
top: 30px;
}
.menu-icon-out {
opacity: 0;
top: -20px;
}
/* ////////////////////////////////////// header elements ///// */
.header-el {
border-radius: 50%;
cursor: pointer;
height: 50px;
opacity: 0;
position: absolute;
width: 50px;
top: 10px;
transition: top 0.6s cubic-bezier(.82,.01,.17,1.26);
}
.header-el:hover {
transform:...
JavaScript
(function($) {
var header = $('#header-bg');
var menuButton = $('#menu-icon');
var menuButtonX = $('#menu-icon-x');
var menuIcon = $('.header-el');
var menuIconPhoto = $('#header-photo');
var menuIconPeople = $('#header-people');
var menuIconMex = $('#header-mex');
var menuIconHeart = $('#header-heart');
var homeElement = $('.el-home-anima');
var tlhome = new TimelineMax();
//start
menuButton.addClass('menu-icon-in');
menuButtonX.addClass('menu-icon-out');
header.addClass('header-bg');
tlhome
.staggerFrom(homeElement, 0.6, { y: 20, autoAlpha: 0, ease:Bounce.easeOut}, 0.2)
;
//button menu
menuButton.on('click', function(){
menuButton.removeClass('menu-icon-in');
menuButton.addClass('menu-icon-out');
menuButtonX.addClass('menu-icon-in');
menuButtonX.removeClass('menu-icon-out');
menuIconPhoto.addClass('header-el-anima');
menuIconPeople.addClass('header-el-anima');
menuIconMex.addClass('header-el-anima');
menuIconHeart.addClass('header-el-anima');
});
menuButtonX.on('click', function(){
header.addClass('header-bg');
header.removeClass('header-bg-photo');
header.removeClass('header-bg-people');
header.removeClass('header-bg-mex');
header.removeClass('header-bg-heart');
menuButton.addClass('menu-icon-in');
menuButton.removeClass('menu-icon-out');
menuButtonX.addClass('menu-icon-out');
menuButtonX.removeClass('menu-icon-in');
menuIconPhoto.removeClass('header-el-anima');
menuIconPeople.removeClass('header-el-anima');
menuIconMex.removeClass('header-el-anima');
menuIconHeart.removeClass('header-el-anima');
tlhome.restart();
});
//button Photo
menuIconPhoto.on('click', function(){
menuButton.removeClass('menu-icon-in');
menuButton.addClass('menu-icon-out');
menuButtonX.addClass('menu-icon-in');
...