0
我正在创建电视指南,并已实现上一个和下一个按钮以滚动到下一个小时数,但是当我单击此滚动连续没有终点时。有没有什么办法可以在某个特定时刻阻止这种情况?即每个小时单元为100像素,因此滚动应停止在24x100 = 2400px。其中我使用此jquery的低于:在容器结束时停止滚动Div
$(文件)。就绪(函数(){
var $item = $('.timeCell, .cellProgram'),
visible = 2,
index = 0,
endIndex = ($item.length/visible) - 1;
$('div#arrowR').click(function(){
if(index < endIndex){
index++;
$item.animate({'left':'-=246px'});
}
});
$('div#arrowL').click(function(){
if(index > 0){
index--;
$item.animate({'left':'+=246px'});
}
});
});
任何帮助将不胜感激,谢谢:)