function show_destination(country_id,airport_id){ $.ajax({ type: "POST", url: "function.php", data: "country_id="+country_id+"&airport_id="+airport_id+"&action=destination", beforeSend: function() { $("#loader_destination").html(''); }, success: function(msg){ // $(".loader_destination").empty(); //$("#destination_div").html(msg); //$("#destination_div").slideDown("slow",function(){$("#destination_div").html(msg);}) //$("#destination_div").html(msg,function(){$("#destination_div").slideDown("slow");}); $('#destination_div').slideDown(500, function() { $('#destination_div').html(msg);}); } }); }
slideDown this effect not working , output simply display , am not find any effect on 开发者_JAVA百科display output,
You're not setting the HTML until after the Slidedown has taken effect:
$('#destination_div').slideDown(500, function() {
$('#destination_div').html(msg);
});
You need to switch that up:
$('#destination_div').html(msg).slideDown(500);
Looking at your code I'd say the element is empty for the 500ms it is supposed to be sliding. try:
$('#destination_div').hide().html(msg).slideDown(500);
What are you trying to achieve?
It looks to me like...
$('#destination_div').slideDown(500, function() { $('#destination_div').html(msg);});
...will slide the DIV down and then set the HTML. If the DIV is empty then you will see no animation.
what about:
var $destination_div = $('#destination_div');
$destination_div.html(msg);
$destination_div.slideDown(500);
I'm caching in $destination_div to improve performance, although you could use chaining instead:
$('#destination_div').html(msg).slideDown(500);
You might even want to augment your beforesend method as well:
beforeSend: function() {
$("#loader_destination").html('');
$('#destination_div').hide();
}
精彩评论