I have two effects that I want to run one after another, but I can\'t work out how to pass $(this)
to the callback from the first effect.
This is what I
Give this a shot:
var self = $(this);
if(self.hasClass('flag')) {
$('someElement').slideUp(function() {
self.slideDown();
});
}
cache it like this... just don't forget thevar
.
var $this = $(this);
if($this.hasClass('flag')) {
$('someElement').slideUp(function() {
$this.slideDown();
});
}
Save the reference.
if($(this).hasClass('flag')) {
var el = this;
$('someElement').slideUp(function() {
$(el).slideDown();
});
}