// attach necessary classes for styling
if (this.element.is('div')) {
- // TODO replace hardcoded class names
this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
}
this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
function switchTab(clicked, $li, $hide, $show) {
var classes = ['ui-tabs-selected ui-state-active'];
if (o.deselectable) classes.push('ui-tabs-deselectable');
- // TODO replace hardcoded class names
$li.removeClass('ui-state-default').addClass(classes.join(' '))
.siblings().removeClass(classes.join(' ')).addClass('ui-state-default');
hideTab(clicked, $hide, $show);
// attach tab event handler, unbind to avoid duplicates from former tabifying...
this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
- //var trueClick = event.clientX; // add to history only if true click occured, not a triggered click
var $li = $(this).parents('li:eq(0)'),
$hide = self.$panels.filter(':visible'),
$show = $(self._sanitizeSelector(this.hash));
// or is already loading or click callback returns false stop here.
// Check if click handler returns false last so that it is not executed
// for a disabled or loading tab!
- // TODO replace hardcoded class names
if (($li.hasClass('ui-state-active') && !o.deselectable)
|| $li.hasClass('ui-state-disabled')
|| $(this).hasClass('ui-tabs-loading')
o.selected = self.$tabs.index(this);
// if tab may be closed
- // TODO replace hardcoded class names
if (o.deselectable) {
if ($li.hasClass('ui-state-active')) {
self.options.selected = null;
},
select: function(index) {
- // TODO make null as argument work
if (typeof index == 'string')
index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
this.$tabs.eq(index).trigger(this.options.event + '.tabs');