Jquery expand and shrink on click
This short jquery script makes an element shrink or expand on click. Simple logic is added to make the script toggle in click.
CSS
div{
position: relative;
top: 50%;
left: 50%;
margin-left: -50px;
text-align: center;
background:#333;
width:80px;
height:80px;
border-radius:50%;
overflow: hidden;
}
JavaScript
$(document).ready(function() {
var move = "expand";
$('div').click(function(){
// if (move == "expand"){
$('div').animate({width:"30px",height:"30px"},500);
move = "shrink";
//} else {
$('div').animate({width:"80px",height:"80px"},500);
move = "expand";
//}
});
});