问题
I have two problems with this code:
First I would like to reduce the speed of the effect.
Second as you would for the effect to operate to close a tab and then there will be the following newly tab
if ($('#sidebar ul').length) {
$("#sidebar ul").accordion({
event: "mouseover",
active: 1,
collapsible: false,
autoHeight: false
});
}
Example URL: http://jsfiddle.net/8pKMh/
回答1:
For the speed, use animate:
if ($('#sidebar ul').length) {
$("#sidebar ul").accordion({
event: "mouseover",
active: 1,
collapsible: false,
autoHeight: false,
animate: 2000 // miliseconds
});
}
From the jquery ui docs:
Animate
If and how to animate changing panels.
Multiple types supported:
- Boolean: A value of false will disable animations.
- Number: Duration in milliseconds with default easing.
- String: Name of easing to use with default duration.
- Object: Animation settings with easing and duration properties.
- Can also contain a down property with any of the above options.
- "Down" animations occur when the panel being activated has a lower index than the currently active panel.
来源:https://stackoverflow.com/questions/13346108/reduce-the-speed-of-a-accordion-in-jquery-ui