Reputation: 4507
$(".fader").click(function (e) {
$('.fader').not('#' + $(this).attr("id")).fadeOut(function() {
$($(this).attr("id")).animate({width: "200",height: "200px", top: "-=-440px", left: "-=-367px"});
});
});
fading out works, animate()
works too but with different elements.
Is it the syntax to blame or my CSS that is blocking animate()
?
Upvotes: 0
Views: 69
Reputation: 24506
You do not need to do $($(this).attr("id"))
as $(this)
is fine.
Also, the inner jQuery selector changes the meaning of 'this' to be different. If you want it to stay the same, you need to keep a reference to it first e.g.
$(".fader").click(function (e) {
var self = this;
$('.fader').not(self).fadeOut(function() {
$(self).animate({width: "200",height: "200px", top: "-=440px", left: "-=367px"});
});
});
Upvotes: 1