Skip to main content

Search and Top Navigation

#3946 closed enhancement (worksforme)

Opened January 26, 2009 10:50AM UTC

Closed February 17, 2009 12:05PM UTC

Last modified October 11, 2012 09:15PM UTC

When using "activate", do not animate.

Reported by: mahade Owned by:
Priority: minor Milestone:
Component: ui.accordion Version: 1.6rc5
Keywords: Cc:
Blocked by: Blocking:
Description

If you have an application in which you want to activate the 2nd item in the accordion, you'd normally do:

$('ul.drawers').accordion("activate", 1);

The problem rises when you want an animated accordion. On page load, it initiates the accordion and automatically animates (using 'easeslide') the first item.

If, after initiating the accordion, you use the "activate" code above, it will animate the 2nd item, too.

The proposed solution:

activate: function(index) {
	// NEW: store animation setting temporarily
	var preanimated = this.options.animated;
	// NEW: manually override animation, set to false
	this.options.animated = false;
	// call clickHandler with custom event
	clickHandler.call(this.element[0], {
		target: findActive( this.options.headers, index )[0]
	});
	// NEW: restore animation preference
	this.options.animated = preanimated;
},

Granted, this is merely a quick hack for personal convenience. With some nicer coding and perhaps making this behavior optional, it would make the accordion a lot more usable.

Attachments (0)
Change History (2)

Changed February 17, 2009 12:05PM UTC by jzaefferer comment:1

resolution: → worksforme
status: newclosed

Use the active-option to initalize your accordion without the animation.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted