/*=========================== *作者:动力启航(谢凯) *网址:http://www.it134.cn *转发请保留作者信息,谢谢 ===========================*/ //=====================全局函数======================== //Tab控制函数 function tabs(tabId, tabNum){ //设置点击后的切换样式 $(tabId + " .tab li").removeClass("curr"); $(tabId + " .tab li").eq(tabNum).addClass("curr"); //根据参数决定显示内容 $(tabId + " .tabcon").hide(); $(tabId + " .tabcon").eq(tabNum).show(); } //=====================全局函数======================== //==================图片详细页函数===================== //鼠标经过预览图片函数 function preview(img){ $("#preview .jqzoom img").attr("src",$(img).attr("src")); $("#preview .jqzoom img").attr("jqimg",$(img).attr("bimg")); } //图片放大镜效果 $(function(){ $(".jqzoom").jqueryzoom({xzoom:300,yzoom:300}); }); //图片预览小图移动效果,页面加载时触发 $(function(){ var tempLength = 0; //临时变量,当前移动的长度 var viewNum = 5; //设置每次显示图片的个数量 var moveNum = 1; //每次移动的数量 var moveTime = 300; //移动速度,毫秒 var scrollDiv = $(".sorllMenu2 .items ul"); //进行移动动画的容器 var scrollItems = $(".sorllMenu2 .items ul li"); //移动容器里的集合 var moveLength = scrollItems.eq(0).width() * moveNum; //计算每次移动的长度 var countLength = (scrollItems.length - viewNum) * scrollItems.eq(0).width(); //计算总长度,总个数*单个长度 $(".sorllMenu2 .prev").css({"background":"url(/skin/tongfa/images/fz_l.jpg) no-repeat","cursor":"default"}) //下一张 $(".sorllMenu2 .next").bind("click",function(){ var nextzc=tempLength+moveLength; if(tempLength < countLength){ $(".sorllMenu2 .prev").css({"background":"","cursor":"pointer"}) if((countLength - tempLength) > moveLength){ scrollDiv.animate({left:"-=" + moveLength + "px"}, moveTime); tempLength += moveLength; }else{ scrollDiv.animate({left:"-=" + (countLength - tempLength) + "px"}, moveTime); tempLength += (countLength - tempLength); } } if(nextzc==countLength) { $(this).css({ "background": "url(/skin/tongfa/images/fz_r.jpg) no-repeat", "cursor": "default" }) } }); //上一张 $(".sorllMenu2 .prev").bind("click",function(){ var nextzc=tempLength+moveLength; if(tempLength > 0){ $(".sorllMenu2 .next").css({"background":"","cursor":"pointer"}) if(tempLength > moveLength){ scrollDiv.animate({left: "+=" + moveLength + "px"}, moveTime); tempLength -= moveLength; }else{ scrollDiv.animate({left: "+=" + tempLength + "px"}, moveTime); tempLength = 0; } } if(nextzc==countLength) { $(this).css({ "background": "url(/skin/tongfa/images/fz_l.jpg) no-repeat", "cursor": "default" }) } }); }); //==================图片详细页函数=====================