這甚至是假設通過向下添加類來移動div。但它提前? 。標題沒有打到頂部,它已經在旅途中!?jquery切換類不能完全工作
$(document).ready(function(){
$(window).scroll(function() {
var moveit = $('.title'), //the titles are to move
targetScroll = $('.title').position().top, //when .title is at top
currentScroll = $(document.body).scrollTop();
moveit.toggleClass('down', currentScroll >= targetScroll);
});
});
#box #left ul li:hover .down {
top: 500px;
}
.down包含的方式提前。
我在做什麼錯......它盯着我臉上不是嗎?
你的代碼的工作:http://jsfiddle.net/RVbCq/就非常有可能的CSS問題更多。 – 2012-02-27 22:23:26