jquery easing problem

南楼画角 提交于 2019-12-24 14:09:49

问题


I have what I thought was a simple piece of jquery, but it's turning out to be a pain.

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.

Any ideas?

   $('.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 is hidden initially.

Changing the line to this works which is why I am finding it a little odd...

$("div.myDiv1").slideUp(800, function() {

I'm using Safari and firefox on a mac to test it...


回答1:


It depends on the version of jQuery you're using.

From the manual :

.slideUp( [ duration ], [ easing ], [ callback ] )
version added: 1.4.3

It means that if your version is < 1.4.3, it will only understand this :

.slideUp( [ duration ], [ callback ] )

Example working with 1.4.4 :

http://www.jsfiddle.net/gMNL8/1/

Example not working with 1.2.6

http://www.jsfiddle.net/gMNL8/2/

Source : http://api.jquery.com/slideUp/

notes : on my examples => .myDiv2 is hidden to begin with.



来源:https://stackoverflow.com/questions/4427843/jquery-easing-problem

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