我試圖用jQuery移動div的滾動,但我不知道我做錯了什麽。
這是我使用的代碼:
$("#CategoryList").animate({ scrollLeft: "=-5" }, "slow");
其中CategoryList是帶滾動的div的ID。
你能幫我個忙嗎? 提前致謝。 Josema。
我試圖用jQuery移動div的滾動,但我不知道我做錯了什麽。
這是我使用的代碼:
$("#CategoryList").animate({ scrollLeft: "=-5" }, "slow");
其中CategoryList是帶滾動的div的ID。
你能幫我個忙嗎? 提前致謝。 Josema。
您應該使用“+ = 5”
並為 #FixedWindow
設置動畫,而不是您的CategoryList
function InitList(){
$("#NavigateBackward")。hover(function(){
$("#FixedWindow")。animate({ scrollLeft: "+=5" }, "slow");
});
$("#NavigateFordward")。hover(function(){
$("#FixedWindow")。animate({ scrollLeft: "-=5" }, "slow");
});
}
。
Category 1
Category 2
Category 3
Category 4
Category 5
</div>
</div>
<div id="FixedWindow" style="width:129px;overflow:hidden;">
<div id="CategoryList" style="width:2000px;overflow:auto;">