开发者

jQuery Ajax animation Chain

开发者 https://www.devze.com 2023-01-23 06:33 出处:网络
The Code $.ajax({ url: \"get_portfolio_experience.php\", success: function(html) { $(\"#inbox_content\").html(html).hide().slideDown(\'slow\');

The Code

$.ajax({
    url: "get_portfolio_experience.php",
    success: function(html) {
        $("#inbox_content").html(html).hide().slideDown('slow');
    }
});

The content doesn't animate if i do not put a hide() before slideDown(). And if i put a开发者_StackOverflow社区 hide() it doesn't show in IE. What should i do?


First, let's shorten this down with .load() like this:

$("#inbox_content").load("get_portfolio_experience.php", function(html) {
  $(this).hide().slideDown('slow');
});

Now for the issues, your explanation of IE behaving weird is almost certainly caused by invalid markup. Check the response coming back, are there any unclosed or invalid tags? Check it with the W3C Validator here: http://validator.w3.org/


You should add a CSS style display: none; for #inbox_content and use this code:

$.ajax({ 
    url: "get_portfolio_experience.php", 
    success: function(html) {
        $("#inbox_content").html(html).slideToggle('slow'); 
    } 
});
0

精彩评论

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