开发者

jquery fadeout timing

I'd like this function to fade the contents of the div out, wait till the fadeout is finished, then fade the new calendar in. What's happening is the new calendar gets loaded, then the fade out and fadein occur. Its like it loads the calendar and then blinks. I can't tell if the load is happening durring the fade 开发者_JS百科out but the timing is definitely off. The fadeout() function isn't waiting till the fade completes to fire the loadContent function. Anybody know how i can fix this?

function ajaxCalendar(X,Y,Z){
            $('#ajaxdiv').fadeOut('300',loadContent());  

            function loadContent() {  
                var changemonthlink = "http://localhost:8888/myproject/calendar/view/" + X + "/" + Y + "/" + Z + "/1";
                $('#ajaxdiv').load(changemonthlink,'',function(){
                   $('#ajaxdiv').fadeIn('300'); 
                });
            }
            return false;   

};


$('#ajaxdiv').fadeOut('300', loadContent());  

should be

$('#ajaxdiv').fadeOut('300', loadContent);

as you need to pass the function not the result of a function call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜