<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="up" class="rep"></div>
<div id="middle" class="trans"></div>
<div id="bottom" class="rep"></div>
<button id='btn'>click me</button>
</body>
</html>
body{
background-color:#000;
}
div{
position:absolute;
background-color:#fff;
height:3px;
margin-top:8px;
width:30px;
overflow:hidden;
margin-left:200px;
}
#up{
top:0;
}
#middle{
top:10px;
}
#bottom{
top:20px;
}
.trans{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.rep{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
$('#btn').click(function(){
$('#middle').css({
marginLeft:100,
backgroundColor:'#000'
});
$('#up').css({
transform:'rotate(45deg)',
top:10
});
$('#bottom').css({
transform:'rotate(-45deg)',
top:10
});
});