mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
This commit is contained in:
parent
422e0666e9
commit
c31ae93dc5
@ -21,7 +21,7 @@ $.widget("ui.tabs", {
|
|||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
var o = this.options;
|
var o = this.options;
|
||||||
this.element.unbind('.tabs')
|
this.list.unbind('.tabs')
|
||||||
.removeClass(o.navClass).removeData('tabs');
|
.removeClass(o.navClass).removeData('tabs');
|
||||||
this.$tabs.each(function() {
|
this.$tabs.each(function() {
|
||||||
var href = $.data(this, 'href.tabs');
|
var href = $.data(this, 'href.tabs');
|
||||||
@ -66,13 +66,14 @@ $.widget("ui.tabs", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_cookie: function() {
|
_cookie: function() {
|
||||||
var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.element[0]));
|
var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.list[0]));
|
||||||
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
|
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
|
||||||
},
|
},
|
||||||
|
|
||||||
_tabify: function(init) {
|
_tabify: function(init) {
|
||||||
|
|
||||||
this.$lis = $('li:has(a[href])', this.element.is('div') ? $('> ul:first', this.element) : this.element);
|
this.list = this.element.is('div') ? this.element.children('ul:first, ol:first').eq(0) : this.element;
|
||||||
|
this.$lis = $('li:has(a[href])', this.list);
|
||||||
this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
|
this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
|
||||||
this.$panels = $([]);
|
this.$panels = $([]);
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ $.widget("ui.tabs", {
|
|||||||
var $panel = $('#' + id);
|
var $panel = $('#' + id);
|
||||||
if (!$panel.length) {
|
if (!$panel.length) {
|
||||||
$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
|
$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
|
||||||
.insertAfter(self.$panels[i - 1] || self.element);
|
.insertAfter(self.$panels[i - 1] || self.list);
|
||||||
$panel.data('destroy.tabs', true);
|
$panel.data('destroy.tabs', true);
|
||||||
}
|
}
|
||||||
self.$panels = self.$panels.add($panel);
|
self.$panels = self.$panels.add($panel);
|
||||||
@ -108,11 +109,8 @@ $.widget("ui.tabs", {
|
|||||||
if (this.element.is('div')) {
|
if (this.element.is('div')) {
|
||||||
// TODO replace hardcoded class names
|
// TODO replace hardcoded class names
|
||||||
this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
|
this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
|
||||||
$('> ul:first', this.element).addClass(o.navClass);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.element.addClass(o.navClass);
|
|
||||||
}
|
}
|
||||||
|
this.list.addClass(o.navClass);
|
||||||
this.$lis.addClass(o.tabClass);
|
this.$lis.addClass(o.tabClass);
|
||||||
this.$panels.addClass(o.panelClass);
|
this.$panels.addClass(o.panelClass);
|
||||||
|
|
||||||
@ -360,8 +358,8 @@ $.widget("ui.tabs", {
|
|||||||
}
|
}
|
||||||
$panel.addClass(o.panelClass);
|
$panel.addClass(o.panelClass);
|
||||||
if (index >= this.$lis.length) {
|
if (index >= this.$lis.length) {
|
||||||
$li.appendTo(this.element);
|
$li.appendTo(this.list);
|
||||||
$panel.appendTo(this.element[0].parentNode);
|
$panel.appendTo(this.list[0].parentNode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$li.insertBefore(this.$lis[index]);
|
$li.insertBefore(this.$lis[index]);
|
||||||
|
Loading…
Reference in New Issue
Block a user