Sussagittikasusa
Sussagittikasusa

Reputation: 2581

jQuery Ajax animation Chain

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 hide() it doesn't show in IE. What should i do?

Upvotes: 0

Views: 373

Answers (2)

Nick Craver
Nick Craver

Reputation: 630389

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/

Upvotes: 1

Alex Rashkov
Alex Rashkov

Reputation: 10015

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'); 
    } 
});

Upvotes: 0

Related Questions