Reduce the speed of a accordion in jquery UI

拥有回忆 提交于 2019-12-10 13:44:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!