在jquery ui show上应用缓动?

时间:2011-04-16 23:15:06

标签: jquery css jquery-ui jquery-effects easing

我正在尝试在jquery ui show效果上应用缓动。理想情况下,api看起来像这样:

$(this).show('scale', {
  duration: 1000,
  easing: 'easeOutBounce', 
});

目前元素显示为:none。我需要用缩放效果来显示它并且有一个缓和。

我是否必须将命令分开,或者是否有类似的东西可以使用?

感谢。

3 个答案:

答案 0 :(得分:11)

我在jsfiddle上测试了它并且可以工作:

$('.div1').show('scale', {
  duration: 1000,
  easing: 'easeOutBounce', 
});​

http://jsfiddle.net/tenshimsm/AUM6d/1/

答案 1 :(得分:4)

您需要在(,)之后移除逗号easeOutBounce,然后它才能正常工作

$(this).show('scale', {
  duration: 1000,
  easing: 'easeOutBounce' 
});

答案 2 :(得分:-1)

检查firebug,使用代码示例时会添加一些隐藏字符:

            jQuery('#search-container .fa-search').toggle('scale', {duration: 1000,easing: 'easeOutBounce'});​
            jQuery('#homepage-search').toggle('scale', {duration: 1000,easing: 'easeOutBounce'});​