2012-02-05 36 views
-1

有人可以說出了什麼事嗎?起初,我已經加載jQuery Waypoint(http://imakewebthings.github.com/jquery-waypoints/),然後包含您可以在文本之後看到的代碼。 當我向頁面滾動時,我需要淡入淡出效果,但沒有任何效果。我發現這個解決方案在這裏堆棧溢出 - JQuery fade-in a div when user scrolls to that div 這裏是我試圖做我的解決方案的鏈接 - http://layot.prestatrend.com 謝謝!沒有錯誤,但jQuery代碼不起作用

// by default your element will be hidden 
$('.ajax_block_product').hide(); 
// call waypoint plugin 
$('.ajax_block_product').waypoint(function(event, direction) { 
    // do your fade in here 
    $(this).fadeIn(); 
}, { 
    offset: function() { 
     // The bottom of the element is in view 
     return $.waypoints('viewportHeight') - $(this).outerHeight(); 
    } 
}); 
+0

你忘了粘貼代碼嗎? – JJJ 2012-02-05 20:26:05

+0

您提供的實際信息很少,以幫助您。我們可以永遠查看插件頁面,過去的問題和jquery引用,甚至不會猜測**你的**代碼有什麼問題。 – Scott 2012-02-05 20:30:18

+0

請嘗試以下,它應該工作。 – 2012-02-05 20:30:26

回答

0

jQuery隱藏功能在元素上設置display:nonedisplay:none元素不會報告正確的offset。嘗試最初將不透明度設置爲0或隱藏的可見性。

相關問題