| 23 |
selectedClass: "selected", |
selectedClass: "selected", |
| 24 |
alwaysOpen: true, |
alwaysOpen: true, |
| 25 |
animated: 'slide', |
animated: 'slide', |
| 26 |
event: "click" |
event: "click", |
| 27 |
|
header: "a" |
| 28 |
}, |
}, |
| 29 |
animations: { |
animations: { |
| 30 |
slide: function(settings, additions) { |
slide: function(settings, additions) { |
| 46 |
settings.toShow.css({ height: 0, overflow: 'hidden' }).show(); |
settings.toShow.css({ height: 0, overflow: 'hidden' }).show(); |
| 47 |
settings.toHide.filter(":hidden").each(settings.finished).end().filter(":visible").animate({height:"hide"},{ |
settings.toHide.filter(":hidden").each(settings.finished).end().filter(":visible").animate({height:"hide"},{ |
| 48 |
step: function(n){ |
step: function(n){ |
| 49 |
settings.toShow.height(Math.ceil( (hideHeight - ($.fn.stop ? n * hideHeight : n)) * difference )); |
settings.toShow.height(Math.ceil( (hideHeight - (n)) * difference )); |
| 50 |
}, |
}, |
| 51 |
duration: settings.duration, |
duration: settings.duration, |
| 52 |
easing: settings.easing, |
easing: settings.easing, |
| 95 |
return this; |
return this; |
| 96 |
|
|
| 97 |
// setup configuration |
// setup configuration |
| 98 |
settings = $.extend({}, $.ui.accordion.defaults, { |
settings = $.extend({}, $.ui.accordion.defaults, settings); |
|
// define context defaults |
|
|
header: $(':first-child', this)[0].tagName // take first childs tagName as header |
|
|
}, settings); |
|
| 99 |
|
|
| 100 |
if ( settings.navigation ) { |
if ( settings.navigation ) { |
| 101 |
var current = this.find("a").filter(function() { return this.href == location.href; }); |
var current = this.find("a").filter(function() { return this.href == location.href; }); |
| 135 |
.not(active || "") |
.not(active || "") |
| 136 |
.nextUntil(settings.header) |
.nextUntil(settings.header) |
| 137 |
.hide(); |
.hide(); |
| 138 |
active.addClass(settings.selectedClass); |
active.parent().andSelf().addClass(settings.selectedClass); |
| 139 |
|
|
| 140 |
|
|
| 141 |
function findActive(selector) { |
function findActive(selector) { |
| 142 |
return selector != undefined |
return selector != undefined |
| 143 |
? typeof selector == "number" |
? typeof selector == "number" |
| 144 |
? headers.eq(selector) |
? headers.filter(":eq(" + selector + ")") |
| 145 |
: headers.not(headers.not(selector)) |
: headers.not(headers.not(selector)) |
| 146 |
: selector === false |
: selector === false |
| 147 |
? $("<div>") |
? $("<div>") |
| 148 |
: headers.eq(0) |
: headers.filter(":eq(0)"); |
| 149 |
} |
} |
| 150 |
|
|
| 151 |
function toggle(toShow, toHide, data, clickedActive, down) { |
function toggle(toShow, toHide, data, clickedActive, down) { |
| 208 |
return; |
return; |
| 209 |
|
|
| 210 |
// switch classes |
// switch classes |
| 211 |
active.toggleClass(settings.selectedClass); |
active.parent().andSelf().toggleClass(settings.selectedClass); |
| 212 |
if ( !clickedActive ) { |
if ( !clickedActive ) { |
| 213 |
clicked.addClass(settings.selectedClass); |
clicked.parent().andSelf().addClass(settings.selectedClass); |
| 214 |
} |
} |
| 215 |
|
|
| 216 |
// find elements to show and hide |
// find elements to show and hide |