2014-05-17 66 views
1

我在我的css中有一個photoshow的類。他們是圖像。我希望它們在頁面加載時淡出並淡入。任何與wysihtml5第一行工作正常。有任何想法嗎?爲什麼不是這個jQuery的工作? Image fadeIn和fadeOut

控制檯錯誤:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 

小號

$(document).ready(function(){ 

    $('.wysihtml5').each(function(i, elem) { 
    $(elem).wysihtml5(); 
    }); 


    $('.photoshow').fadeOut().fadeIn('slow'); 

}) 

這裏的HTML

<%= link_to 'Back', :back %> <br> 
    <%#= @photo.name %> 
    <div class="photoshow"> 
    <%= image_tag @photo.image.url, width: '500', class: 'photoshow' %> 
    </div> 
+3

應該工作得很好 - > http://jsfiddle.net/adeneo/zD7t5/ – adeneo

+0

有趣。我不知道這裏發生了什麼事。 :( –

+0

打開您的控制檯(F12)並檢查錯誤? – adeneo

回答

0

你可以嘗試類似的做法: -

$(document).ready(function() { 
    // Hides the picture so no one can see it 
    $('.photoshow').hide(0); 

    $('.wysihtml5').each(function(i, elem) { 
     $(elem).wysihtml5(); 
    }); 

    // Fades the picture in 
    $('.photoshow').fadeIn('slow'); 
}); 
+0

這沒有效果。其他事情正在發生。 –

相關問題