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.
by aljon254
HTML
<div></div>
CSS
div{
background:#333;
width:80px;
height:80px;
}
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";
}
});
});