// seems to be expected behavior that the show callback is fired
var onShow = function() {
- $(self.element).triggerHandler('tabsshow',
- [self.fakeEvent('tabsshow'), self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);
- };
+ self.trigger('show', null,
+ self.ui(self.$tabs[o.selected], self.$panels[o.selected]));
+ };
// load if remote tab
if ($.data(this.$tabs[o.selected], 'load.tabs'))
// just trigger show event
else
onShow();
-
}
// clean up to avoid memory leaks in certain versions of IE 6
$show[0].style.filter = '';
// callback
- $(self.element).triggerHandler('tabsshow',
- [self.fakeEvent('tabsshow'), self.ui(clicked, $show[0])], o.show);
-
+ self.trigger('show', null, self.ui(clicked, $show[0]));
});
}
if (($li.hasClass(o.selectedClass) && !o.unselect)
|| $li.hasClass(o.disabledClass)
|| $(this).hasClass(o.loadingClass)
- || $(self.element).triggerHandler('tabsselect', [self.fakeEvent('tabsselect'), self.ui(this, $show[0])], o.select) === false
+ || self.trigger('select', null, self.ui(this, $show[0])) === false
) {
this.blur();
return false;
}
// callback
- this.element.triggerHandler('tabsadd',
- [this.fakeEvent('tabsadd'), this.ui(this.$tabs[index], this.$panels[index])], o.add
- );
+ this.trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
},
remove: function(index) {
var o = this.options, $li = this.$lis.eq(index).remove(),
this.tabify();
// callback
- this.element.triggerHandler('tabsremove',
- [this.fakeEvent('tabsremove'), this.ui($li.find('a')[0], $panel[0])], o.remove
- );
+ this.trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
},
enable: function(index) {
var o = this.options;
o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
// callback
- this.element.triggerHandler('tabsenable',
- [this.fakeEvent('tabsenable'), this.ui(this.$tabs[index], this.$panels[index])], o.enable
- );
-
+ this.trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
},
disable: function(index) {
var self = this, o = this.options;
o.disabled.sort();
// callback
- this.element.triggerHandler('tabsdisable',
- [this.fakeEvent('tabsdisable'), this.ui(this.$tabs[index], this.$panels[index])], o.disable
- );
+ this.trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index]));
}
},
select: function(index) {
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
// callbacks
- $(self.element).triggerHandler('tabsload',
- [self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load
- );
+ self.trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
o.ajaxOptions.success && o.ajaxOptions.success(r, s);
// This callback is required because the switch has to take
$(this).removeClass([o.selectedClass, o.unselectClass,
o.disabledClass, o.panelClass, o.hideClass].join(' '));
});
- },
- fakeEvent: function(type) {
- return $.event.fix({
- type: type,
- target: this.element[0]
- });
}
});