Ich habe ein Jquery-Plugin, das ich erstellt habe, zeigt Inhalt und verbirgt Inhalt in einer Registerkarte wie Schnittstelle. Was ich möchte, ist ein Ereignis auszulösen, wenn Inhalte gezeigt werden, auf die ich dann in meinem Quellcode achten kann, und ein darauf basierendes Ereignis auszulösen, ist das möglich?jquery plugin hinzufügen Ereignis Listener
Hier ist mein Plugin,
$.fn.appsTabs = function(options){
// These are the defaults.
var settings = $.extend({
// These are the defaults.
selected: "home"
}, options);
// Set Active
$(this).find('.pops-tabs-navigation li[data-route="'+settings.selected+'"]').addClass('active');
// Hide All Boxes and show first one
$(this).find('.apps-tabs-content .pops-tab-content').addClass('cloak');
$(this).find('.pops-tabs-content .pops-tab-content#content-'+settings.selected).removeClass('cloak');
// Get Clicks on Li in Navigation
$(this).find('.apps-tabs-navigation li').click(function(){
if($(this).hasClass('active') == false) {
// Get ID of Tab
id = $(this).attr('id');
tabid = 'content-'+id;
// Set Active
$(this).parent('.apps-tabs-navigation').find('li').removeClass('active');
$(this).addClass('active');
// Hide all boxes
$(this).parent('.apps-tabs-navigation').parents('.pops-tabs').find('.pops-tabs-content .pops-tab-content').addClass('cloak');
$(this).parent('.apps-tabs-navigation').parents('.pops-tabs').find('.pops-tabs-content #'+tabid).removeClass('cloak');
}
});
}
Ist es möglich, etwas zu dem Prototyp vielleicht hinzufügen und für den in meinem Haupt-Anwendungscode hören?