我在HTML頁面中有三個div。頁面看起來像這樣javascript slide slick_accessible_slideshow
HTML頁:
leftArrow(>) div rightArrow(<)
我需要從左至右,從右到左移動的股利。使用javascript和DHTMl
或JQuery。
是否有可能朝那個方向移動?
我在HTML頁面中有三個div。頁面看起來像這樣javascript slide slick_accessible_slideshow
HTML頁:
leftArrow(>) div rightArrow(<)
我需要從左至右,從右到左移動的股利。使用javascript和DHTMl
或JQuery。
是否有可能朝那個方向移動?
是的,這是可能的,我過去沒有使用jQuery。
我有以下標記:
<div id="HorThumbs" style="overflow:hidden;width:500px">
<div id="HorScroller" style="width:1000px">
//Data to be shown
</div>
</div>
var scrollStep=1;
var timerLeft,timerRight="";
function scrollDivLeft(id){
clearTimeout(timerRight);
document.getElementById(id).scrollLeft-=scrollStep;
timerRight=setTimeout("scrollDivLeft('"+id+"')",1);
}
function scrollRight(id){
clearTimeout(timerLeft);
document.getElementById(id).scrollLeft+=scrollStep;
timerLeft=setTimeout("scrollRight('"+id+"')",1);
}
然後鼠標懸停事件添加到您的左右箭頭,傳遞「HorThumbs」作爲ID要麼scrollDivLeft或scrollDivRight功能。
看看jQuery cycle plugin。它將向左/向右滾動並允許上一個/下一個按鈕。