Skip to content

Commit

Permalink
Collapsible speed = 1 when initialising
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Lüscher committed Jan 11, 2010
1 parent be7c386 commit c9d9832
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/jquery-inline-collapsible.js
Expand Up @@ -7,29 +7,34 @@ function makeCollapsible(target, item, collapsible, triggerTarget, setInitStatus
var triggerAppend = ' )';

$(target).find(item).each(function(i) {
$(this).find(collapsible).slideUp(1);

var trigger = $(triggerLink)
$(this).find(triggerTarget).append(trigger);
trigger.before(triggerPrepend);
trigger.after(triggerAppend);
var item = this
var toggleCollapse = function(status)
var toggleCollapse = function(status, speed)
{
if (status == null) {
status = !item.collapseStatus;
}
if (speed == null) {
speed = 1;
}
item.collapseStatus = status;
if (status) {
trigger.html(triggerCollapse);
$(item).find(collapsible).slideDown("normal");
$(item).find(collapsible).slideDown(speed);
} else {
trigger.html(triggerExpand);
$(item).find(collapsible).slideUp("normal");
$(item).find(collapsible).slideUp(speed);
}
}

trigger.click(function(event) {
event.preventDefault();
toggleCollapse()
toggleCollapse(null, 'normal')
})

// Collapse by default unless there are errors
Expand Down

0 comments on commit c9d9832

Please sign in to comment.