2011-09-29 68 views
0

如何在數據返回到#results div時添加淡入效果?如何在jQuery文本中添加淡入效果

$('#results').html(data); 

我試圖

$('#results').html(data).fadeIn('slow'); 

,但它似乎沒有工作

我的代碼

 submitHandler: function(form) { 
      // do other stuff for a valid form 
      $.post('mailme.php', $("#myform").serialize(), function(data) { 
       $('#results').html(data).fadeIn('slow'); 
      }); 
     } 
+0

安置自己的整版代碼在這裏,用CSS。 –

+0

@abdulwakeel這是投票的原因嗎? – EnexoOnoma

+0

也許你只需要先把它隱藏起來 – David

回答

3

你得先隱藏股利。

$('#results').hide().html(data).fadeIn('slow'); 
0

這可能只是伎倆。

$('#results').css('display', 'none').html(data).fadeIn('slow'); 
0

當您使用「淡入」時,您必須首先隱藏元素。

這裏是一個例子,我相信努力和編輯,經過你就會明白:

<img style="display: none;" id="google" src="http://www.google.com.tr/images/srpr/logo3w.png" alt="" /> 

<script> 
    $(document).ready(function() { 
     $('#google').fadeIn(1200,function(){}); 
    }); 
</script> 
相關問題