<div class="header --flex-row">
<div id="back" class="back --flex-column-j!c-ai!c do-ripple" ripple-size="200">
<div class="arrow"></div>
</div>
<div class="place" ripple-size="200">
<div class="icons">
<div class="home"><i class="fa fa-home" aria-hidden="true"></i></div>
<div class="now"><i class="fa fa-pencil" aria-hidden="true"></i></div>
<div class="next"><i class="fa fa-question" aria-hidden="true"></i></div>
</div>
</div>
</div>
<div class="nav do-ripple" ripple-size="80">
<div class="item do-ripple" ripple-size="64" tab-id="write"><i class="fa fa-pencil" aria-hidden="true"></i></div>
<div class="item do-ripple" ripple-size="64" tab-id="history"><i class="fa fa-book" aria-hidden="true"></i></div>
<div class="item do-ripple" ripple-size="64" tab-id="loved"><i class="fa fa-heart" aria-hidden="true"></i></div>
<div class="item do-ripple" ripple-size="64" tab-id="settings"><i class="fa fa-cog" aria-hidden="true"></i></div>
</div>
<div class="capture hide"></div>
body {
background-color: #ECEFF1;
.do-ripple {
overflow: hidden;
.ripple {
position: absolute;
animation: ripple 0.3s linear;
background-color: #ccc;
border-radius: 100%;
opacity: 0;
pointer-events: none;
z-index: 1;
}
>*:not(.ripple) {
z-index: 2;
}
}
.header {
overflow: hidden;
position: fixed;
top: 0px;
left: 0px;
right: 0px;
height: 100px;
background-color: #ffffff;
box-shadow: 0 -6px 8px 4px rgba(0, 0, 0, 0.3);
.back {
background-color: #144ACC;
z-index: 3;
cursor: pointer;
transition: 0.5s;
width: 50px;
height: 400px;
padding-left: 350px;
margin-right: -365px;
border-radius: 100%;
transform: translate(-87.5%, -50%) translateY(50px);
box-shadow: 1px 2px 8px -1px rgba(0, 0, 0, 0.1);
.arrow {
position: relative;
width: 17px;
height: 2px;
margin-left: 3px;
background-color: #ffffff;
pointer-events: none;
&:before,
&:after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg) translate(-2px, 7px);
width: 12px;
height: 2px;
background-color: #ffffff;
}
&:after {
transform: translate(-50%, -50%) rotate(-45deg) translate(-2px, -7px);
}
}
&.hide {
margin-left: -50px;
border-radius: 0%;
}
}
.place {
background-color: #2F73E9;
width: 100px;
height: 400px;
padding-left: 250px;
margin-right: -365px;
border-radius: 100%;
transform: translate(-65%, -50%) translateY(50px);
z-index: 2;
.icons {
position: absolute;
top: 50%;
left: calc(75% + 31px);
transform: translate(-50%, -50%);
color: #fff;
font-size: 32px;
line-height: 66px;
transition: top 0.5s ease;
&.home {
top: calc(50% + 66px);
}
&.next {
top: calc(50% - 66px);
}
&.noanimation {
transition: top 0s ease;
}
}
}
}
.capture {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background-color: rgba(0, 0, 0, 0.3);
z-index: 0;
opacity: 1;
pointer-events: auto;
transition: opacity 0.25s ease;
&.hide {
opacity: 0;
pointer-events: none;
}
}
.nav {
position: fixed;
height: 40px;
width: 40px;
top: 30px;
left: 135px;
background-color: #4395FA;
border-radius: 20px;
transition: 0.5s;
cursor: pointer;
z-index: 1;
box-shadow: 1px 2px 8px -1px rgba(0, 0, 0, 0.1);
&.home {
left: 85px;
}
.item {
transition: 0.5s;
width: 6px;
height: 6px;
background-color: #fff;
position: absolute;
border-radius: 20px;
transform: translate(-50%, -50%);
.ripple {
display: none;
background-color: #ECEFF1;
}
&:nth-child(1) {
top: 35%;
left: 35%;
}
&:nth-child(2) {
top: 65%;
left: 35%;
}
&:nth-child(3) {
top: 35%;
left: 65%;
}
&:nth-child(4) {
top: 65%;
left: 65%;
}
i {
transition: 0.5s;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #144ACC;
opacity: 0;
}
}
&.open {
width: 156px;
.item {
top: 50%;
width: 32px;
height: 32px;
&:nth-child(1) {
left: 14%;
}
&:nth-child(2) {
left: 38%;
}
&:nth-child(3) {
left: 62%;
}
&:nth-child(4) {
left: 86%;
}
&:active {
transform: translate(-50%, -50%) scale(0.9);
}
i {
opacity: 1;
}
.ripple {
display: block;
}
}
}
}
}
@keyframes ripple {
0%,
100% {
display: block;
}
0% {
opacity: 0.3;
width: 0px;
height: 0px;
transform: translate(-50%, -50%) scale(0);
}
100% {
opacity: 0;
transform: translate(-50%, -50%) scale(1);
}
}
View Compiled
var pages = {
current: "write",
index: {
write: {
id: "write",
name: "Write",
icon: "fa-pencil"
},
history: {
id: "history",
name: "History",
icon: "fa-book"
},
loved: {
id: "loved",
name: "Loved",
icon: "fa-heart"
},
settings: {
id: "settings",
name: "Settings",
icon: "fa-cog"
}
}
};
$(document).ready(function() {
console.log(Object.keys(pages.index));
for(var i = 0; i < 4; i++) {
console.log(Object.keys(pages.index)[i]);
$(`.nav .item:nth-child(${i + 1})`).find("i").attr("class", `fa ${pages.index[Object.keys(pages.index)[i]].icon}`)
}
$(document).on("click", ".do-ripple", function(e) {
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
var s = $(this).attr("ripple-size");
$(this).append(`<div class="ripple" style="width:${s}px; height:${s}px; top:${y}px; left:${x}px"></div>`);
});
$(document).on("click", "#back", function(e) {
$(this).addClass("hide");
$(".icons").addClass("home");
$(".nav").addClass("home");
pages["current"] = "home";
});
$(document).on("click", ".capture", function(e) {
$(".nav").removeClass("open");
$(".capture").addClass("hide");
});
$(document).on("click", ".nav:not(.open)", function(e) {
$(this).addClass("open");
$(".capture").removeClass("hide");
});
$(document).on("click", ".nav.open .item", function(e) {
var id = $(this).attr("tab-id");
if (pages["current"] == "home") {
$(".place .icons .now i").removeClass().addClass("fa").addClass(pages["index"][id]["icon"]);
} else {
$(".place .icons .next i").removeClass().addClass("fa").addClass(pages["index"][id]["icon"]);
$(".place .icons").addClass("next");
setTimeout(function() {
$(".place .icons").addClass("noanimation");
$(".place .icons .now i").removeClass().addClass("fa").addClass(pages["index"][id]["icon"]);
$(".place .icons").removeClass("next");
setTimeout(function() {
$(".place .icons").removeClass("noanimation");
}, 10);
}, 500);
}
pages["current"] = id;
$("#back").removeClass("hide");
$(".icons").removeClass("home");
$(".nav").removeClass("home").removeClass("open");
$(".capture").addClass("hide");
});
});
View Compiled