//获取当前位置设置 /* (function getSetAddr() { rdcp.request("!Manage/Express/~java/IPRegionUtil.getCurrentIpInfo", null, function (data) { }, { mask: false }); })(); */ var img_index = 0;//图片当前的序号 var moveArr = [0,-440,-880,-1320,-1760];//上面图片移动数值 var oLi_len = $('.ifocus_btnList li').length;//oLi数量 var clearBanner = null;//定时轮播 // normal-隐藏 current-显示 //点击切换轮播 $('.ifocus_step').on('click',function () { clearInterval(clearBanner); var clickIndex = $(this).index(); var nowIndex = img_index; if(clickIndex == 0){//le nowIndex--; if(nowIndex<0)nowIndex = oLi_len-1; }else if(clickIndex == 2){ nowIndex++; nowIndex%=oLi_len; }else{ alert('你点到哪里了?') } imgChange(nowIndex); }); //触摸切换 $('#ifocus_btn li').hover(function () { //停止轮播 clearInterval(clearBanner); var getIndex = $(this).index(); imgChange(getIndex); },function () { //继续轮播 clearBanner = setInterval(setBanFn,2000); }); //定时轮播 clearBanner = setInterval(setBanFn,2000); //定时轮播函数 function setBanFn() { var nowIndex = img_index; nowIndex++; nowIndex%=oLi_len; imgChange(nowIndex); } //图片切换 function imgChange(nowIndex) { // img_index 上一个序号 //nowIndex 当前进度的图片序号 //单图过度动画操作 $('#ifocus_piclist').css({left:moveArr[nowIndex]}); //图片列表操作 //上一个隐藏 $('.ifocus_btnList li').eq(img_index).removeClass('current'); //去掉显示天赋 $('.ifocus_btnList li').eq(img_index).addClass('normal'); //添加隐藏天赋 //下一个显示 $('.ifocus_btnList li').eq(nowIndex).removeClass('normal'); //去掉隐藏天赋 $('.ifocus_btnList li').eq(nowIndex).addClass('current'); //添加显示天赋 img_index = nowIndex;//序号切换 } //-------------------------------------------------------------------------- //商品数量 $(".addbutton").click(function () { var value = parseInt($('.input').val()) + 1; $('.input').val(value); }) $(".minusbutton").click(function () { var num = $(".input").val() if (num > 0) { $(".input").val(num - 1); } }) //商品详情 $(".details-choose").click(function (event) { $(this).addClass('active').siblings().removeClass('active'); }); $(".details-introduce").click(function (event) { $('.details-introduce i').addClass('selected'); $(".details-comment i").removeClass('selected2'); $('.details-show-img').show(); $(".comments-list").hide(); }); $(".details-comment").click(function (event) { $('.details-comment i').addClass('selected2'); $(".details-introduce i").removeClass('selected'); $('.details-show-img').hide(); $(".comments-list").show(); }); $(".botton-pay").click(function (event) { $(this).addClass('com-button-selected').siblings().removeClass('com-button-selected'); }); $(".button-package").click(function (event) { if ($(this).hasClass('com-button-selected')) { $(this).removeClass('com-button-selected'); } else { $(this).addClass('com-button-selected').siblings().removeClass('com-button-selected'); } }); try { $(function () { $(".firstGoods img").delayLoading({ defaultImg: "!Front/Common/~/images/loading.gif", // 预加载前显示的图片 errorImg: "", // 读取图片错误时替换图片(默认:与defaultImg一样) imgSrcAttr: "originalSrc", // 记录图片路径的属性(默认:originalSrc,页面img的src属性也要替换为originalSrc) beforehand: 0, // 预先提前多少像素加载图片(默认:0) event: "scroll", // 触发加载图片事件(默认:scroll) duration: "normal", // 三种预定淡出(入)速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如:1000),默认:"normal" container: window, // 对象加载的位置容器(默认:window) success: function (imgObj) { }, // 加载图片成功后的回调函数(默认:不执行任何操作) error: function (imgObj) { } // 加载图片失败后的回调函数(默认:不执行任何操作) }); }); }catch (e){ console.log(e); }