Я использую ООП и jQuery в своих разработках.
Раньше я передавал свой текущий объект this
в функции jQuery следующим образом:
$(myElement).live('click', this, function(el){
// I can access to my JS object using el.data
});
Но я не могу найти, как сделать то же самое с функцией jQuery .queue()
.
Возможно ли это?
EDIT
Я даю вам контекст, в котором я хочу использовать .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();
});
}
};