I'm working on a small image gallery which just enlarges a picture when you click on it. I'm making it with jQuery by adding and removing classes.
$(".image").click(function() {
$(this).addClass("big").removeClass("image").css("position", "fixed").animate({
height: '480px',
width: '717px',
top: '5%',
left: '50%',
marginLeft: '-358px',
borderWidth: '40px',
zIndex: '100'
}, "slow");
});
$(".big").click(function() {
$(this).removeClass("big").addClass("image").css("position", "auto").animate({
height: '234px',
width: '350px',
top: 'auto',
left: 'auto',
marginLeft: '0px',
borderWidth: '0px',
zIndex: 'auto'
}, "slow");
});
The problem i'm having is that it does remove the image class and adds the big class but it doesn't work the otherway around, what am I doing wrong?