.wrapper
%ul.items
- (1...5).each do
%li
%a{:href => "#"} Lorem ipsum
%ul.sub-items
- (1...3).each do
%li
%a{:href => "#"} Lorem ipsum dolor sit amet.
View Compiled
/*
* Developer: Alex Eskandari
* Designer: Nevide (codecanyon.net/user/Nevide)
*
* Distributed under the terms of the MIT license
* https://opensource.org/licenses/MIT
*/
@blueColor: #64D7E2;
@hover: #8EE8F1;
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
a {
color: #646464;
text-decoration: none;
}
body {
background-color: @blueColor;
font-family: "Source Sans Pro", sans-serif;
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
margin-top: -140px;
margin-left: -140px;
width: 280px;
background-color: #fff;
box-shadow: 0 4px 10px #7A9BAC;
font-size: 0.875em;
}
.items {
padding: 18px 0;
}
.items > li > a {
display: block;
margin: 0 auto;
width: 90%;
text-indent: 18px;
line-height: 39px;
}
.items > li > a::after {
position: absolute;
right: 30px;
margin-top: 2px;
font-family: "FontAwesome"
}
.items > li > a::after {
right: 30px;
content: "\f061";
}
.itemHover {
color: #fff;
font-weight: 600;
transition: background-color .4s ease-in-out;
}
.items > li > a:hover {
background-color: @hover;
.itemHover
}
.items > li > a.expanded {
background-color: @blueColor;
.itemHover
}
.items > li > a.expanded::after {
content: "\f063";
}
.sub-items > li:first-child > a {
margin-top: 17px;
height: 34px;
}
.sub-items > li:last-child > a {
margin-bottom: 17px;
height: 34px;
}
.sub-items a {
position: relative;
display: block;
margin: 0 auto;
width: 212px;
text-indent: 24px;
line-height: 39px;
}
.sub-items a {
border-left: 2px solid @blueColor;
}
.sub-items .current {
position: relative;
color: @blueColor;
border-color: white;
}
.sub-items > li:hover > a {
color: @blueColor;
transition: color 0.4s ease-in-out;
}
.sub-items {
display: none;
}
View Compiled
$(".items > li > a").click(function(e) {
e.preventDefault();
var $this = $(this);
if ($this.hasClass("expanded")) {
$this.removeClass("expanded");
} else {
$(".items a.expanded").removeClass("expanded");
$this.addClass("expanded");
$(".sub-items").filter(":visible").slideUp("normal");
}
$this.parent().children("ul").stop(true, true).slideToggle("normal");
});
$(".sub-items a").click(function() {
$(".sub-items a").removeClass("current");
$(this).addClass("current");
});
This Pen doesn't use any external CSS resources.