0

I know this will be easy for somebody that knows jQUERY. I have recently started learning and struggling to animate the results that are being loaded via AJAX. Im wanting in to fade in. Where would i put this code in?

 fadeIn("slow")

here is my ajax loader:

 $(document).ready(function(){
 var file_name = 'test.php';
 $("div#mybox").load(file_name,function(responseTxt,statusTxt,xhr), {
 if(statusTxt=="error")
 // bla bla
 });
 });

Your help is much appreciated :) Luke

4

1 回答 1

0

您需要将“动画”代码放入 ajax 的成功回调函数中。

success : function (data) { [animationcodehere] }

更新: 使用加载功能,您可以这样做:

 $(document).ready(function(){
 var file_name = 'test.php';
 $("div#mybox").load(file_name,function(responseTxt,statusTxt,xhr), function() {
   $("div#mybox").fadeIn('slow');
  });
 });
于 2013-08-14T09:08:14.330 回答