<div class="wrapper">
<div class="item">
I am an element
<div class="close"></div>
</div>
<div class="item">
I am an element
<div class="close"></div>
</div>
<div class="item">
I am an element
<div class="close"></div>
</div>
<div class="item last">
I am an element
<div class="close"></div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Lato);
body{
background-color: rgb(230, 230, 233);
font-family: 'Lato', sans-serif;
}
.wrapper{
width: 400px;
margin: 0 auto;
padding: 40px 0;
&.active{
.item{
background-color: rgb(240, 240, 240);
&.active{
background-color: #0083F5;
color: white;
}
}
}
}
.item{
border-bottom: 1px solid fade(black, 10%);
background-color: white;
width: 400px;
height: 50px;
transition-duration: 0.5s;
position: relative;
padding-top: 30px;
text-align: center;
&:hover{
cursor: pointer;
background-color: rgb(245, 245, 245);
}
.close{
display: none;
width: 30px;
height: 30px;
border-radius: 15px;
background-color: white;
position: absolute;
right: 20px;
top: 50%;
margin-top: -15px;
box-shadow: 0 3px 2px fade(black, 20%);
&:hover{
box-shadow: 0 3px 2px fade(black, 40%);
cursor: pointer;
&:before{
transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
}
&:after{
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
}
&:before, &:after{
width: 16px;
height: 2px;
border-radius: 2px;
background-color: #0083F5;
position: absolute;
content: "";
top: 14px;
left:7px;
transition-duration: 0.33s;
}
&:before{
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
&:after{
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
}
&.last{
border-bottom: none;
}
&.margin{
margin-bottom: 20px;
margin-top: 20px;
}
&.active{
box-shadow: 0px 5px 10px fade(black, 20%);
border-bottom: none;
color: black;
transition-delay: 0.5s;
transform: scale(1.1, 1.1);
-webkit-transition-delay: 0.5s;
-webkit-transform: scale(1.1, 1.1);
}
}
View Compiled
$('.item').click(function (){
$('.wrapper').addClass('active');
$('.item').removeClass('active').removeClass('margin');
$('.close').fadeOut(300);
$(this).addClass('active').addClass('margin');
$('.close', this).delay(700).fadeIn(300);
});
$('.close').click(function (event){
event.stopPropagation();
$('.wrapper').removeClass('active');
$('.item').removeClass('active').removeClass('margin');
$('.close').fadeOut(300);
});
This Pen doesn't use any external CSS resources.