目前试图找出这个..我建立一个网站,它的所有基于100%宽度/高度div部分,所以我不知道这是为什么JS不工作。不过,我试图让每个滚动到下一节的代码示例都在下面淡出。如何淡入DIV的正确滚动?
<div class="hideme">
<a href="#" id="display" class="display">
<div class="navigation arrowdown pa2">
<span style="color:#fff;">The mission is here</span>
</div><!--end arrowdown-->
</a><!--end display-->
</div><!--end hideme-->
我用同样
<div class="hideme">
<a href="#" id="display" class="display">
<div class="navigation arrowdown pa3">
<span style="color:#fff;">The solution is here</span>
</div><!--end arrowdown-->
</a><!--end display-->
</div><!--end hideme-->
再次重复像这样,这里是我的JS;第二部分按预期工作,但第三部分没有。
<script type="text/javascript">
$(document).ready(function() {
/* Every time the window is scrolled ... */
$(window).scroll(function(){
/* Check the location of each desired element */
$('.hideme').each(function(i){
var bottom_of_object = $(this).position().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if(bottom_of_window > bottom_of_object){
$(this).animate({'opacity':'1'},5000);
}
});
});
});
</script>
这里是我工作的现场直播:http://bit.ly/1eGCShX
凡是我的思念,或导致它已经1混浊我不能使用相同的hideme类?感谢您花时间阅读本文!祝你有个愉快的一周。
在jsfiddle中添加您的代码 – Abhidev
将我的整个网站或此确切代码放在最好吗?我不确定它是否可能影响我自己的其他脚本。通过实时检测是最简单的,感谢您的建议! – DoPeT
所有你需要做的就是添加一个示例代码(html/css/js),而不是整个网站。祝一切顺利。 :) – Abhidev