<div class="wrapper">
<div class="slideItWrapper">
<a href="#modal" class="slideIt">
<span class="open">open</span>
<span class="close">close</span>
</a>
</div>
<section>
<h2>Hello World!</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.</p>
</section>
<aside id="pageslide">
<div id="modal">
<h3>Menu!</h3>
<ul>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
</ul>
<a class="close" href="#">Close</a>
</div>
</aside>
</div>
@import "compass/css3";
/* STYLES */
body{
font-family:"Helvetica Neue", Helvetica, sans-serif;
font-weight:200;
line-height:1.5;
letter-spacing:1px;
font-size:16px;
}
h2{
font-weight:200;
}
.slideItWrapper{
position:relative;
}
.slideIt{
left:8px;
color:white;
font-weight:bold;
text-decoration:none;
background-color:#7E64BF;
display:block;
width:30px;
height:30px;
border-radius:40px;
position:relative;
span{
font-size:20px;
left:6px;
top:-3px;
position:absolute;
text-align:center;
text-indent:-9999px;
display:block;
height:100%;
width:100%;
transition: all 1s ease;
transition: all 1s ease;
height: 100%;
left: 0;
overflow: hidden;
background-image: url('http://purplerockscissors.com/wp-content/themes/prpl/images/casestudies/bg-controls.png');
background-size: 150%;
background-position:4px 7px;
&.open{
background-position:4px 7px;
opacity:1;
transform: scale(1,1);
transform: scale(1,1);
}
&.close{
background-position:-19px 7px;
opacity:0;
transform: scale(0,0);
transform: scale(0,0);
}
}
&.active .close{
opacity:1;
transform: scale(1,1);
transform: scale(1,1);
}
&.active .open{
opacity:0;
transform: scale(0,0);
transform: scale(0,0);
}
&:before{
content:'';
position:absolute;
display:block;
width: 0;
height: 0;
left:-13px;
top:10px;
border-top: 5px solid transparent;
border-right: 10px solid #7E64BF;
border-bottom: 5px solid transparent;
}
&:hover:before {
left:-9px;
transition: all 0.5s ease;
transition: all 0.5s ease;
}
}
section{
width:500px;
margin:0 auto;
}
/* REQUIRED */
#pageslide {
/* These styles MUST be included. Do not change. */
display: none;
position: absolute;
position: fixed;
top: 0;
height: 100%;
z-index: 999999;
/* Specify the width of your pageslide here */
width: 240px;
/* styles */
background: #7E64BF;
left: -240px;
text-shadow: 0 1px 1px rgba(0,0,0,0.1);
h3{
font-size: 1.8em;
margin:0;
padding: 20px;
font-weight: 300;
color: #fff;
}
ul{
list-style: none;
padding:0;
margin:0;
}
li a{
display: block;
color: #fff;
font-size: 1.1em;
line-height: 3.5;
padding: 0 20px;
cursor: pointer;
border-bottom: 1px solid #594786;
text-decoration:none;
&:hover{
background: #6E58A6;
}
}
}
View Compiled
$(document).ready(function() {
var slideWidth = $('#pageslide').outerWidth(); //grab width of the sliding menu so that this can be controlled in the css only
$('.slideIt, #pageslide a.close').on("click", function(){ //click function
$('.slideIt').toggleClass('active'); //toggle the active close vs open icon
if($('#pageslide').is(':visible')) { //if visible then hide it
$('#pageslide').animate({
left: '-'+slideWidth
}, 400, function(){
$('#pageslide').hide();
} );
$('.wrapper').animate({
marginLeft: '0'
}, 400 );
$('.slideIt span').text('☰');
}
else{ //else show it
$('#pageslide').show().animate({
left: '0'
}, 400 );
$('.wrapper').animate({
marginLeft: slideWidth
}, 400 );
}
});
});
This Pen doesn't use any external CSS resources.