锘?/$(".headerTop").load("../include/head.html"); //$(".footbox").load("../include/footer.html"); if($(".s_nav").find("a").length <= 1){ $(".s_nav").hide(); } $(".s_nav").addClass("w1600"); $(".s_nav").wrap('
'); $(".sendBanner").removeClass("w1600"); //宸﹀皫鑸 $(".left_nav li").each(function(){ $(this).attr("data-num",$(this).index()); }); $(".right_mes>div").each(function(){ $(this).find(".q_title").attr("data-num",$(this).index()); }) var num = $(".left_nav .on").attr("data-num"); $(".left_nav li").click(function(){ //$(this).find("a").attr("href","javascriptrt:void(0);") $(this).addClass("on").siblings().removeClass("on"); var index = $(this).index(); var top = $(".right_mes>div").eq(index).offset().top; $("html").stop().animate({"scrollTop":top+"px"},200); $("body").stop().animate({"scrollTop":top+"px"},200); console.log(index); }); $(".left_nav li").hover(function(){ var index = $(this).index(); var height = $(this).outerHeight(); $(".line").css({ top:index*height+10+"px" }) },function(){ var num = $(".left_nav .on").index(); console.log(111,num); $(".line").css({ top:num*$(".left_nav .on").outerHeight()+10+"px" }) }); //鍒嗛〉璁$畻瀹藉害 if($("div").hasClass("pageList")){ var widt = $(".pageList>a").length*$(".pageList").find("a").outerWidth()+$(".pageList").find("ul").outerWidth(); console.log($(".pageList>a").length,$(".pageList").find("a").outerWidth(),$(".pageList").find("ul").outerWidth()) $(".pageList").css({ width:widt }) } //杩斿洖闋傞儴 if(!$("img").hasClass("backtop")){ $("body").append(''); console.log(3333); } var winHeight = $(window).height(); if($("div").hasClass("con_mes")){ var offTop = $(".con_mes .left_nav").offset().top; } window.onscroll = function () { // var winScroll = document.documentElement.scrollTop || document.body.scrollTop; // var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; var winScroll = $("html").scrollTop() || $("body").scrollTop(); var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; if (winScroll >=winHeight) { $(".backtop").show(); }else{ $(".backtop").hide(); } leftNav(); } $(".backtop").click(function(){ //$("body,html").scrollTop(0); $("html").animate({ "scrollTop":0 },300); $("body").animate({ "scrollTop":0 },300) }) //宸︿晶瀵艰埅鑱斿姩 leftNav(); $(window).resize(function () { leftNav(); }) function leftNav(){ if($(".left_nav li").size()&&$(".left_nav li").size()==$(".right_mes>div").size()){ var ah = $(window).height() * 0.25; //婊氬姩鏉℃粴鍔ㄨ窛绂 var srcollTop = $("html").scrollTop() || $("body").scrollTop(); //鍐呭鍖鸿窛绂婚《閮ㄩ珮搴 var navTop = $(".con_txt").offset().top; //宸﹀鑸珮搴 var navHeight = $(".left_nav").height(); var index = 0; //宸﹀鑸厓绱犻珮搴 var height = $(".left_nav li").outerHeight(); //宸﹀鑸窛绂婚《閮ㄩ珮搴 var pageY = $(".left_nav").offset().top; //鍐呭鍖洪珮搴 var domHeight = $(".con_txt").height(); if(srcollTop > navTop){ $(".con_mes .left_nav").addClass("fixed").css("top","0px"); if(pageY + navHeight >= navTop + domHeight){ if(pageY > srcollTop){ $(".con_mes .left_nav").addClass("fixed").css("top","0px"); }else{ var top = domHeight - navHeight; $(".con_mes .left_nav").removeClass("fixed").css("top",top); } }else{ $(".con_mes .left_nav").addClass("fixed").css("top","0px"); } }else{ $(".con_mes .left_nav").removeClass("fixed"); } $(".right_mes>div").each(function () { var stop = $(this).offset().top; $(this).attr("data-top",stop); if(srcollTop + ah > stop){ index = $(this).index(); } }) $(".left_nav li").eq(index).addClass("on").siblings().removeClass("on"); $(".line").css({ top:index*height+10+"px" }) } } /**new**/ //璁$畻; var canTabClick = true; newComput(); function newComput(){ $(".scollTabBox ul").width(''); $(".scollTabBox li:last").css("margin-right",0); var size = $(".scollTabBox li").size(); var allW = 0; var marNum = parseFloat($(".scollTabBox li").css("marginRight")); for(var i = 0; i< size; i++){ allW += parseFloat($(".scollTabBox li").eq(i).width()) + marNum; } $(".scollTabBox ul").width(allW - marNum + 2); } proctComput(); window.onload = function(){ proctComput(); } function proctComput(){ $(".itemList li").each(function(){ var w = 0; var maxW = $(this).find(".modelLists").width(); $(this).find(".modeItemCont").attr("data-w",maxW); var pw = $(this).find(".modeItem p").width(); var pl = parseFloat($(this).find(".modeItem p").css('margin-left')); var size = $(this).find(".modeItem p").size(); w = size * (pw + 2 + pl * 2); $(this).find(".modeItem").width(w); if(w > maxW + pl ){ $(this).find(".tabPocrt").show(); }else{ $(this).find(".tabPocrt").hide(); } }) } proctComput1(); function proctComput1(){ var size = $(".imgBoxs li").size(); var w = 0; var maxW = $(".imgBoxs").width(); var pw = $(".imgBoxs li").width(); var pl = parseFloat($(".imgBoxs li").css('margin-left')); w = size * (pw + 2 + pl * 2); $(".imgBoxs ul").width(w); if(w > maxW){ $(".n_tabButton").show(); }else{ $(".n_tabButton").hide(); } } $(".modeItem p").click(function(){ $(this).addClass("chost").siblings().removeClass("chost"); }); $(".nextTab").click(function(){ if(canTabClick){ canTabClick = false; var moveW = $(this).parent().find(".modeItemCont").width(); var srcL = parseFloat($(this).parent().find(".modeItemCont").scrollLeft()); $(this).parent().find(".modeItemCont").animate({"scrollLeft":srcL + moveW},200,function(){ canTabClick = true; }) } }); $(".prevTab").click(function(){ if(canTabClick){ canTabClick = false; var moveW = $(this).parent().find(".modeItemCont").width(); var srcL = parseFloat($(this).parent().find(".modeItemCont").scrollLeft()); $(this).parent().find(".modeItemCont").animate({"scrollLeft":srcL-moveW},200,function(){ canTabClick = true; }) } }); $(".np_next").click(function(){ if(canTabClick){ canTabClick = false; var moveW = $(this).parent().find(".imgBoxs").width(); var srcL = parseFloat($(this).parent().find(".imgBoxs").scrollLeft()); $(this).parent().find(".imgBoxs").animate({"scrollLeft":srcL + moveW},200,function(){ canTabClick = true; }) } }); $(".np_prev").click(function(){ if(canTabClick){ canTabClick = false; var moveW = $(this).parent().find(".imgBoxs").width(); var srcL = parseFloat($(this).parent().find(".imgBoxs").scrollLeft()); $(this).parent().find(".imgBoxs").animate({"scrollLeft":srcL-moveW},200,function(){ canTabClick = true; }) } }); function ProductDetailsFixed(){ var _this = this; this.init = function(){ this.addDom(); this.scrollEvent(); this.resize(); this.scroll(); } this.resize = function(){ $(window).resize(function(){ _this.scrollEvent(); }) } this.scroll = function(){ $(window).scroll(function(){ _this.scrollEvent(); }) } this.scrollEvent = function(){ var scrollTop = $("html").scrollTop() || $("body").scrollTop(); var tops1 = $(".detailsMsgBox").offset().top; var index = 0; var H = $(".rightHotPorcdut").height(); if(scrollTop > tops1){ $(".fixedBoxNav").show(); }else{ $(".fixedBoxNav").hide(); } if(scrollTop > tops1 + H){ $(".fixedBoxNav").addClass("fixedBoxNavd"); }else{ $(".fixedBoxNav").removeClass("fixedBoxNavd"); } $(".itemiMGBox").each(function(){ var top = $(this).offset().top; if(top < scrollTop + 60){ index = $(this).index(); } }) $(".headDetilsTop").each(function(){ $(this).find("li").eq(index).addClass("chost").siblings().removeClass("chost"); }) } this.addDom = function () { $("body").append("
" + "
" + "

" + "
"); $(".fixedBoxNav .headDetilsTop").html($(".headDetilsTop").html()); $(".fixedBoxNav .rightHotPorcdut h2").html($(".rightHotPorcdut h2").html()); $(".headDetilsTop li").click(function(){ var index = $(this).index(); $(".headDetilsTop").each(function(){ $(this).find("li").eq(index).addClass("chost").siblings().removeClass("chost"); }) var top = $(".itemiMGBox").eq(index).offset().top - 50; $("html").animate({ "scrollTop":top },300); $("body").animate({ "scrollTop":top },300) }) } this.init(); } $(".clostBox").click(function(){ $(".buyPopBox").removeClass("buyPopBoxd"); }) $(window).resize(function(){ newComput(); proctComput(); //proctComput1(); });