#3946 closed enhancement (worksforme)
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.
Note: See
TracTickets for help on using
tickets.
Use the active-option to initalize your accordion without the animation.