Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce the speed of a accordion in jquery UI

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/

like image 994
Raul Valverde Avatar asked Nov 12 '12 15:11

Raul Valverde


1 Answers

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.
like image 135
Mario S Avatar answered Oct 16 '22 06:10

Mario S