2011-07-07 88 views
1

我想从Ajax请求添加加载的HTML Div效果(例如向下滑动)。
我使用这个代码,但它并没有影响尚未:将Html添加到Div效果jQuery

obj.html(msg.d).show('slow'); 

这可能吗?

更新:这是我的全码:

$.ajax({ 
      type: "POST", 
      url: options.webServiceName + "/" + options.renderUCMethod, 
      data: options.ucMethodJsonParams, 
      contentType: "application/json; charset=utf-8", 
      dataType: "json", 
      cache: true, 
      success: 
        function (msg) { 
         var html = msg.d; 
         obj.html(msg.d).show('slow'); 



         // if specified make callback and pass element 
         if (options.completeHandler) 
          options.completeHandler(this); 
        }, 
      error: 
        function (XMLHttpRequest, textStatus, errorThrown) { 
         if (options.errorHandler) { 
          options.errorHandler(this); 
         } else { 


          obj.html("error"); 
         } 


        } 
     }); 
+0

看看这个答案http://stackoverflow.com/questions/1520178/jquery-using-append-with-effects –

+0

我写了我的代码从这个答案,但不工作。 – Shahin

回答

1

应该努力 - 我认为“目标文件”是,你可以尝试它分成两个只是为了确保你不有什么好笑的事情发生。

$(obj).html(msg.d); $(obj).show(500); // 500 ms animation time

+0

谢谢。我的问题是Div没有隐藏起来。 – Shahin

1

是的,你可以,但你的对象必须首先隐藏的,所以这样做:

obj.hide().html(msg.d).show('slow'); 

希望这有助于。干杯