mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
accordion: formatting changes - moved some things around for consistency.
_init and destroy at the top. Sorted defaults alphabetically.
This commit is contained in:
parent
1c97a20d01
commit
03d6a64695
@ -13,6 +13,7 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
$.widget("ui.accordion", {
|
$.widget("ui.accordion", {
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
|
|
||||||
@ -96,6 +97,19 @@ $.widget("ui.accordion", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);
|
||||||
|
this.options.headers.prev(".ui-accordion-left").remove();
|
||||||
|
this.options.headers.children(".ui-accordion-right").remove();
|
||||||
|
this.options.headers.next().css("display", "");
|
||||||
|
if ( this.options.fillSpace || this.options.autoHeight ) {
|
||||||
|
this.options.headers.next().css("height", "");
|
||||||
|
}
|
||||||
|
$.removeData(this.element[0], "accordion");
|
||||||
|
|
||||||
|
this.element.removeClass("ui-accordion").unbind(".accordion");
|
||||||
|
},
|
||||||
|
|
||||||
_keydown: function(event) {
|
_keydown: function(event) {
|
||||||
if (this.options.disabled || event.altKey || event.ctrlKey)
|
if (this.options.disabled || event.altKey || event.ctrlKey)
|
||||||
return;
|
return;
|
||||||
@ -135,20 +149,8 @@ $.widget("ui.accordion", {
|
|||||||
clickHandler.call(this.element[0], {
|
clickHandler.call(this.element[0], {
|
||||||
target: findActive( this.options.headers, index )[0]
|
target: findActive( this.options.headers, index )[0]
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function() {
|
|
||||||
this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);
|
|
||||||
this.options.headers.prev(".ui-accordion-left").remove();
|
|
||||||
this.options.headers.children(".ui-accordion-right").remove();
|
|
||||||
this.options.headers.next().css("display", "");
|
|
||||||
if ( this.options.fillSpace || this.options.autoHeight ) {
|
|
||||||
this.options.headers.next().css("height", "");
|
|
||||||
}
|
}
|
||||||
$.removeData(this.element[0], "accordion");
|
|
||||||
|
|
||||||
this.element.removeClass("ui-accordion").unbind(".accordion");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function scopeCallback(callback, scope) {
|
function scopeCallback(callback, scope) {
|
||||||
@ -329,16 +331,16 @@ function findActive(headers, selector) {
|
|||||||
$.extend($.ui.accordion, {
|
$.extend($.ui.accordion, {
|
||||||
version: "@VERSION",
|
version: "@VERSION",
|
||||||
defaults: {
|
defaults: {
|
||||||
selectedClass: "selected",
|
autoHeight: true,
|
||||||
alwaysOpen: true,
|
alwaysOpen: true,
|
||||||
animated: 'slide',
|
animated: 'slide',
|
||||||
event: "click",
|
event: "click",
|
||||||
header: "a",
|
header: "a",
|
||||||
autoHeight: true,
|
|
||||||
running: 0,
|
|
||||||
navigationFilter: function() {
|
navigationFilter: function() {
|
||||||
return this.href.toLowerCase() == location.href.toLowerCase();
|
return this.href.toLowerCase() == location.href.toLowerCase();
|
||||||
}
|
},
|
||||||
|
running: 0,
|
||||||
|
selectedClass: "selected"
|
||||||
},
|
},
|
||||||
animations: {
|
animations: {
|
||||||
slide: function(options, additions) {
|
slide: function(options, additions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user