I use OOP and jQuery in my developments.
I used to passed my current object this to jQuery functions like this :
$(myElement).live('click', this, function(el){
// I can access to my JS object using el.data
});
But I can't find how to do similar thing with jQuery function .queue().
Is it possible ?
EDIT
I give you the context in which I want to use .queue() :
CAPTIVEA.widget.Message = {
/**
* Displays generated message on the screen
* @method display
* @public
*/
display: function() {
// Display Message
$('.message')[this.effects.show](this.effects.duration, function(){
$(this).show();
$('.message span').show();
$('.message').children().show();
});
if (this.autoHide)
{ // Remove message after delay
$('.message').data('objMessage', this);
$('.message').delay(3000).queue(function(el){
$(this).data('objMessage').close();
});
}
},
/**
* Removes generated message from the screen
* @method close
* @public
*/
close: function() {
$('.message')[this.effects.hide](this.effects.duration, function(){
$(this).remove();
});
}
};
$(myElement).queue(function(el){});? Cos that's possible...thisrepresent in your code?.queue(). That method just operates on whatever jQuery object it happened to be called from. Do you need this data associated with a particular element, or set of elements? If so, have you considered$.data()?