没有错误,但jQuery代码不起作用

问题描述:

有人可以说出了什么事吗?起初,我已经加载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

jQuery隐藏功能在元素上设置display:nonedisplay:none元素不会报告正确的offset。尝试最初将不透明度设置为0或隐藏的可见性。