/*******以下不得删除*******/ /*产品内页产品放大左右滚动效果*/ $(function () { $(".items ul li img").hover(function () { var img_url = $(this).attr("src"); $(this).closest(".showb_scroll").siblings(".showb_preview").children("span").children("img").attr("src", img_url); /*var img_bimg=$(this).attr("bimg"); $(this).closest(".showb_scroll").siblings(".showb_preview").children("span").children("img").attr("jqimg",img_bimg);*/ }) /*if($(".showb_preview").children(".jqzoom").length>0){ $(".jqzoom").jqueryzoom({xzoom:380,yzoom:410}); }*/ //下一张 //var templength = 0; //临时变量,当前移动的长度 $(".showb_scroll .next").bind("click", function () { var templength = number($(this).parent(".showb_scroll").attr("bimg")) var viewnum = 3; //设置每次显示图片的个数量 var movenum = 1; //每次移动的数量 var movetime = 300; //移动速度,毫秒 var scrolldiv = $(this).siblings(".items").children("ul") //$(".showb_scroll .items ul"); //进行移动动画的容器 var scrollitems = $(this).siblings(".items").children("ul").children("li") //$(".showb_scroll .items ul li"); //移动容器里的集合 var movelength = scrollitems.eq(0).width() * movenum; //计算每次移动的长度 var countlength = (scrollitems.length - viewnum) * scrollitems.eq(0).width(); //计算总长度,总个数*单个长度 if (templength < countlength) { if ((countlength - templength) > movelength) { scrolldiv.animate({ left: "-=" + movelength + "px" }, movetime); templength += movelength; $(this).parent(".showb_scroll").attr("bimg", templength) } else { scrolldiv.animate({ left: "-=" + (countlength - templength) + "px" }, movetime); templength += (countlength - templength); $(this).parent(".showb_scroll").attr("bimg", templength) } } }); //上一张 $(".showb_scroll .prev").bind("click", function () { var templength = number($(this).parent(".showb_scroll").attr("bimg")) var viewnum = 3; //设置每次显示图片的个数量 var movenum = 1; //每次移动的数量 var movetime = 300; //移动速度,毫秒 var scrolldiv = $(this).siblings(".items").children("ul") //$(".showb_scroll .items ul"); //进行移动动画的容器 var scrollitems = $(this).siblings(".items").children("ul").children("li") //$(".showb_scroll .items ul li"); //移动容器里的集合 var movelength = scrollitems.eq(0).width() * movenum; //计算每次移动的长度 var countlength = (scrollitems.length - viewnum) * scrollitems.eq(0).width(); //计算总长度,总个数*单个长度 if (templength > 0) { if (templength > movelength) { scrolldiv.animate({ left: "+=" + movelength + "px" }, movetime); templength -= movelength; $(this).parent(".showb_scroll").attr("bimg", templength) } else { scrolldiv.animate({ left: "+=" + templength + "px" }, movetime); templength = 0; $(this).parent(".showb_scroll").attr("bimg", templength) } } }); // 字母大写 for (var i = 0; i < $('.txt_yw').length; i++) { $(' .txt_yw').eq(i).text($('.txt_yw').eq(i).text().touppercase()); } });