Change animation speed of Jquery UI Accordion

谁说胖子不能爱 提交于 2019-12-09 05:27:58

问题


I'm using the Jquery UI Accordion, and I haven't found anywhere in the documentation on how to change the speed of the animation. I've found people suggest using option "animated: 'bounceslide'" but haven't been able to find what the different available options are for animated.

My current js is as follows

    $( "#accordion" ).accordion({
        event: "mouseover",
        animate:"slow",
        active:false
    });

The "animate:"slow" is not correct and therefore not working. Any ideas?


回答1:


This is currently not directly possible, although a feature request has been logged and is scheduled to implemented by the 1.9 milestone: http://bugs.jqueryui.com/ticket/3772. You can either wait for that release, or try the subclassing method described here: http://bugs.jqueryui.com/ticket/3533.

This boils down to:

$.extend($.ui.accordion.animations, {
  fastslide: function(options) {
    $.ui.accordion.animations.slide(options, { duration: 100 }); }
  });



回答2:


This works fine for me :

$("#accordion").accordion({
    animate: {
        duration: 500
    }
});



回答3:


if you set the 'animated' to say swing then you can set the 'duration' of the animation in milliseconds. e.g. $( "#accordion" ).accordion({event: "mouseover", animated: 'swing', duration: 500, active:false });




回答4:


Try using

speed: 50

Where 50 is the number of miliseconds

or

speed: 'slow' 

instead of

animate:"slow",


来源:https://stackoverflow.com/questions/7559539/change-animation-speed-of-jquery-ui-accordion

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