i'm trying to make images on my site a bigger size if you click on them.
i want to undo the enlarged view if you click on the picture again.
$("img").click(function(){
var grown = 'false';
if (grown == 'true') {
$(this).animate({width: 300, height: 200}, 1000 );
var grown = 'false';
console.log(grown);
}
else if (grown == 'false') {
$(this).animate({width: 600, height: 400}, 1000 );
var grown = 'true';
console.log(grown);
}
});
enlarging works, but the grown variable seems to always be stuck on true, so it won't ever shrink back.
is my logic flawed? any help greatly appreciated!
'true'instead of justtrueetc