jQuery缓动问题 [英] jquery easing problem
问题描述
我有一个简单的jquery,但事实证明这很痛苦.
I have what I thought was a simple piece of jquery, but it's turning out to be a pain.
其中的slideUp部分工作正常,但随后不会向下滑动...但是,如果我取出slideUp的缓动部分,它确实可以工作.
The slideUp part of this works fine, but it doesn't then slide down... It does work though if I take out the easing part of the slideUp.
有什么想法吗?
$('.clickableDiv').click(function() {
$("<div style='background-image:url(../images/properties/images/bk-01.jpg); width:965px; height:398px;'><img src='../images/properties/text/bk.gif' width='965' height='398' /></div>").prependTo("div.myDiv2");
$("div.myDiv1").slideUp(800, 'easeInOutSine', function() {
$("div.myDiv2").slideDown(800, 'easeInOutSine');
});
});
myDiv2最初是隐藏的.
myDiv2 is hidden initially.
改变这一行的方法,这就是为什么我觉得有点奇怪...
Changing the line to this works which is why I am finding it a little odd...
$("div.myDiv1").slideUp(800, function() {
我正在Mac上使用Safari和Firefox对其进行测试...
I'm using Safari and firefox on a mac to test it...
推荐答案
这取决于您使用的jQuery版本.
It depends on the version of jQuery you're using.
从手册中:
.slideUp([ 持续时间],[缓和],[回调])
添加的版本:1.4.3
.slideUp( [ duration ], [ easing ], [ callback ] )
version added: 1.4.3
这意味着如果您的版本是< 1.4.3,它只会了解这一点:
It means that if your version is < 1.4.3, it will only understand this :
.slideUp([持续时间],[回调])
.slideUp( [ duration ], [ callback ] )
使用1.4.4的示例:
Example working with 1.4.4 :
http://www.jsfiddle.net/gMNL8/1/
示例不适用于1.2.6
Example not working with 1.2.6
http://www.jsfiddle.net/gMNL8/2/
来源: http://api.jquery.com/slideUp/
笔记:在我的示例中=> .myDiv2
最初是隐藏的.
notes : on my examples => .myDiv2
is hidden to begin with.
这篇关于jQuery缓动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!