您的位置:首页 > Web前端 > JavaScript

JS-商品图片点击轮换

2015-07-10 23:03 483 查看
//小图预览区域图片轮换键
const LIWIDTH=62;
var moveCount=0;
document.getElementById("btForward").onclick=function(){
if(this.className=="forward_disabled"){
return;
}
moveCount++;
iconList.style.left=moveCount*LIWIDTH*(-1)+"px";
document.getElementById("btBack").className="backward";
if(moveCount>=imgList.length-5){
this.className="forward_disabled";
}
}
document.getElementById("btBack").onclick=function(){
if(this.className=="backward_disabled"){
return;
}
moveCount--;
iconList.style.left=moveCount*LIWIDTH*(-1)+"px";
document.getElementById("btForward").className="forward";
if(moveCount<=0){
this.className="backward_disabled";
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: