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";
}
}
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";
}
}
相关文章推荐
- JS-商品图片放大器
- javascript 事件处理
- Javascript我学之二函数定义
- Js中的window.parent ,window.top,window.self详解
- js 选项卡
- Jsp 自定义tag标签
- [JSOI2007]祖码Zuma/[bzoj]1032
- AFNetworking 使用总结 (用法+JSON解析
- JS中的"=="转换规则
- 另一种场景下的js @提到好友
- 使用bootbox.js(二级务必提交书面和数字到数字中国)
- [.net 面向对象程序设计进阶] (12) 序列化(Serialization)(四) 快速掌握JSON的序列化和反序列化
- 两个页面传参 js
- 创建优雅表格的8个js工具
- js函数中获得当前被点击元素
- JSP——JSTL标签库
- Json入门
- JSON详解
- 在浏览器中使用JS打开并展示PDF文件
- javascript实现下班倒计时效果的方法(可桌面通知)