JSFiddle - React, Tailwind, and code Playground
by ChaseWest
HTML
<section id="home"> <span>Home</span>
</section>
<section id="about"> <span>About</span>
</section>
<section id="contact"> <span>Contact</span>
</section>
<section id="gallery"> <span>Gallery</span>
</section>
CSS
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
section {
position: absolute;
display: table;
width: 50%;
height: 50%;
background: gray;
color: pink;
float: left;
text-align: center;
font-size: 60px;
opacity: .7;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
-webkit-transition: all .25s ease-in-out;
-moz-transition: all .25s ease-in-out;
-o-transition: all .25s ease-in-out;
transition: all .25s ease-in-out;
}
section:hover {
opacity: 1;
color: white;
background: gray;
cursor: pointer;
-webkit-transition: width height .25s ease-in-out;
-moz-transition: width height .25s ease-in-out;
-o-transition: width height .25s ease-in-out;
transition: width height .25s ease-in-out;
}
section span {
display: table-cell;
vertical-align: middle;
}
.main{
z-index: 1;
opacity: 1;
width: 100%;
height: 100%;
}
#home {
top: 0;
left: 0;
background: url(https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xfa1/t31.0-8/10633990_10102213024577930_5510969667862903406_o.jpg) no-repeat center center;
}
#about {
top: 0;
right: 0;
background: url(https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xpf1/t31.0-8/p960x960/10470267_10102253403992260_4491166039345883547_o.jpg) no-repeat center center;
}
#contact {
bottom: 0;
left: 0;
background: url(https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/t31.0-8/p960x960/10712634_10102251318167270_7463290681888298858_o.jpg) no-repeat center center;
}
#gallery {
bottom: 0;
right: 0;
background: url(https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-xaf1/t31.0-8/p960x960/1911972_10102253401058140_5451743774625491451_o.jpg) no-repeat center center;
}
JavaScript
$("section").on("click", addRemoveMain);
function addRemoveMain(e){
var $this = $(this);
if(!$this.hasClass("main")){
$this.addClass("main");
} else {
$this.removeClass("main");
}
}