0

希望这将是一个简单的:我有一个 div 我想在页面加载时滑入屏幕。

我试图找出为什么会这样:

$(function() {
    $('.mydiv').slideDown(500);
});//END ONLOAD

但不是这个:

$(function() {
    $('.mydiv').show('slide', { direction: 'down' }, 500);
});//END ONLOAD

谁能给我一些建议?谢谢!

(ps: CSS 是 .mydiv {display:none;}

4

2 回答 2

1

jQuery 核心不包括show()方法的效果,但是 jQueryUI 扩展show()了效果。您显示的代码将要求您包含 jQueryUI 库(或组件)以及 jQuery 。

show( effect, [options], [speed], [callback] )

jQuery UI show() 文档

于 2012-06-16T01:27:39.810 回答
0

show方法的 Jquery API 文档指出 show 方法定义如下:

.show()
.show( duration [, callback] )
.show( [duration] [, easing] [, callback] )

在哪里:

duration - A string or number determining how long the  animation will run. 
easing - A string indicating which easing function to use for the transition. 
callback - A function to call once the animation is complete.

使用 show 的正确实现是

.show(500);
于 2012-06-16T01:08:01.020 回答