Edit - Ive changed my code:
This works fine:
$(".image-div").click(function () {
if ($(this).css('z-index') == 1)
$(this).css('z-index','2');
else
$(this).css('z-index','1');
});
And this also works:
$(".image-div").click(function () {
if ($(this).css('z-index') == 1)
$(this).animate({
width: '500px'
}, 5000, function() {
// Animation complete.
});
else
$(this).animate({
width: '250px'
}, 5000, function() {
// Animation complete.
});
});
But this doesn't do anything:
$(".image-div").click(function () {
if ($(this).css('z-index') == 1)
$(this).css('z-index','2');
$(this).animate({
width: '500px'
}, 5000, function() {
// Animation complete.
});
else
$(this).css('z-index','1');
$(this).animate({
width: '250px'
}, 5000, function() {
// Animation complete.
});
});
Thanks