开发者

.load and .slideDown does not work first time it runs

开发者 https://www.devze.com 2023-04-12 17:10 出处:网络
Im trying to load external html documents inside a div with .load and .slideDown, but the first time I click on a thumb is doesnt run the animation after the first time it works fine.

Im trying to load external html documents inside a div with .load and .slideDown, but the first time I click on a thumb is doesnt run the animation after the first time it works fine.

If I put a alert between .load and .slideDown the first time it shows the content before I dismiss the alert, after that it waits until i dismiss the alert.

$('.thumbs2').click(function() {

var idStr = ("project/"+$(this).attr('id')) + " #box_project2";
    $('#close2').fadeIn(500).css({'display': 'block', 'height': '25px'}开发者_运维百科);


     $('#box_project2').load(idStr,function(){  
                $(this).slideDown('slow', function() {
                });
        $.scrollTo('#gohere',300);


    });

});


I am assuming the animation that is not working is ".slideDown" It seems fine since you are calling it in the callback. I would try to see if the fadeIn is messing it up by setting it to display block without the fade so it's instant. Also just to make sure, does #box_project2 already exist prior to this being executed? (sorry I would comment but I do not have enough reputation)

0

精彩评论

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

关注公众号