/** * created by hanyanjun */ $(function(){ /*首页解决方案轮播--调用bootstrap*/ // $('#solution.carousel').carousel({ // interval:false, // pause : 'hover', // }); /*登录页轮播*/ try{ if($('.h-lfCharacter .carousel').length>0){ $('.h-lfCharacter .carousel').carousel({ interval: 2000, pause:'none' }); } }catch(e){ } /*首页解决方案轮播*/ /*导航线的位置*/ try{ var plNum = $(".h-headMenu> ul> li.h-headPro").css("padding-left"); $(".h-line4").css("margin-right",parseInt(plNum)*(-1)); $(window).resize(function(){ var plNum = $(".h-headMenu> ul> li.h-headPro").css("padding-left"); $(".h-line4").css("margin-right",parseInt(plNum)*(-1)); }); }catch(e){ } /*左侧导航点击定位右侧内容*/ try{ var allEle = $('div[class*="h-moudle"]'); var headLen = allEle.length; $(".h-nav li a").on("click",function(){ var ddIndex = $(this).attr('href').lastIndexOf('#'); var ddId = $(this).attr('href').substring(ddIndex+1); var windowTop = $('div[name="' + ddId + '"]').offset().top; $("html, body").animate({scrollTop: windowTop}, 'fast'); }); }catch(e){ } /*首页左侧导航定位*/ /*左侧导航位置*/ try{ $(window).scroll(function () { /*左侧导航位置*/ var solutionTop = $("#hNav1").offset().top; if($(this).scrollTop()==solutionTop || $(this).scrollTop()>solutionTop){ $(".h-nav").addClass("h-navFix"); $(".h-leftNav").addClass("h-navFix"); $(".h-leftNav").css("margin-top","0"); }else{ $(".h-nav").removeClass("h-navFix"); $(".h-leftNav").removeClass("h-navFix"); $(".h-leftNav").css("margin-top","26px"); } /*右侧滚动定位左侧菜单*/ for (var i=headLen-1; i>=0; i--) { if ($(this).scrollTop() >=allEle.eq(i).offset().top-40) { var aName = allEle.eq(i).attr("name"); var bName= '#' +aName; var index = i; $('.h-nav li').find('a[href="' + bName + '"]').parent().addClass('h-navActive2').siblings('li').removeClass('h-navActive2'); return false; } else { $('.h-nav li').eq(0).addClass('h-navActive2').siblings('li').removeClass('h-navActive2'); } } }) }catch(e){ } try{ /*点击按钮,手机端菜单的显示隐藏*/ $(".h-mobileBtn").on("click",function(event){ event.stopPropagation(); if($(".h-mobileHead").is(":visible")){ $(".h-mobileHead").hide(200); $(".h-containerAll").animate({marginLeft:'0px'},200); }else{ $(".h-mobileHead").show(200); $(".h-containerAll").animate({marginLeft:'-190px'},200); } }); }catch(e){ } try{ $(".h-mobileHead").siblings().on("click",function(){ // event.stopPropagation(); $(".h-mobileHead").hide(200); $(".h-containerAll").animate({marginLeft:'0px'},200); }); }catch(e){ } try{ /*左侧菜单的收缩开始*/ $(".h-mHead2").parent().find("> a").on("click",function(event){ event.stopPropagation(); var parent = $(this).parent(); var sub = parent.find('> .h-mHead2'); if(sub.is(':visible')) { sub.slideUp(200, function(){ parent.removeClass('h-navactive'); }); } else { parent.parent().find("> li").each(function() { var t = $(this); if(t.hasClass('h-navactive')) { t.find('> .h-mHead2').slideUp(200, function(){ t.removeClass('h-navactive'); }); } }); parent.addClass('h-navactive'); sub.slideDown(200); } }); }catch(e){ } try{ /*内页左侧菜单*/ $(".h-lMenuinner li a").on("click",function(){ $(this).addClass("h-navactive3"); $(this).parent().siblings().find("a").removeClass('h-navactive3'); }); }catch(e){ } try{ /*内页左侧菜单定位*/ var hhref = window.location.href; $(".h-headMenu a").each(function(){ var locationHref2 = $(this).attr("href"); if(hhref.indexOf(locationHref2)>0){ $(this).parents(".h-headJs").parent().addClass("h-active"); return; } }); $(".h-navLocation li a").each(function(){//左侧定位菜单 var locationHref = $(this).attr("href"); if(hhref.indexOf(locationHref)>0){ $(this).trigger("click"); } }); var flag =false; function h_href(){ h_eachHref(); if(flag==false){//若没有查找到相同的url,则获取上一个页的url hhref = document.referrer; h_eachHref(); } } h_href(); }catch(e){ } try{ /*对菜单中的a标签进行遍历*/ function h_eachHref(){ $(".h-leftMenu li a").each(function(){ var hhref2 = $(this).attr("href"); if(hhref.indexOf(hhref2)>0){ flag =true; if($(this).closest("div").hasClass("h-mHead2")){ $(this).addClass("h-navactive3"); $(this).parent().parent().closest("li").addClass("h-navactive"); }else{ $(this).parent().addClass("h-navactive"); } return; } }); } }catch(e){ } /*主营产品页面定位开始*/ if($(".h-productList").length>0){ var ddIndex = hhref.lastIndexOf('#'); var ddId = hhref.substring(ddIndex+1); var windowTop = $('div[name="' + ddId + '"]').offset().top; $("html, body").animate({scrollTop: windowTop}, 'fast'); } /*主营产品页面定位结束*/ /*左侧菜单的收缩结束*/ try{ /*右侧浮框*/ $(".h-floating-out").hover(function(){ if($(this).hasClass("floatPhone")){ $(this).stop().css("width","auto"); $(".floatPhone").css("padding-right","10px"); var h_wid = $(".floatPhone").width()+10; var h_l = h_wid-54; $(this).stop().animate({"left":"-"+h_l+"px"},300); }else{ $(this).stop().css("width","134px").animate({"left":"-80px"},300); } $(this).css("background-color","#3e3fbf") },function(){ $(this).stop().animate({"left":"0px"},300,function(){ $(this).css("width","54px"); $(this).css("background-color","#383838") }); }); }catch(e){ } try{ /*回到顶部*/ $(".floatTop").click(function(){ $("html, body").animate({scrollTop:"0px"},400); return false; }); }catch(e){ } /*订单查询页面折叠按钮*/ try{ $(".h-foldBtn").on("click",function(){ var $orderCon = $(this).parent().parent().find(".h-orderLogistics"); if($orderCon.is(":visible")){ $orderCon.hide(); $(this).removeClass("h-foldClose"); }else{ $orderCon.show(); $(this).addClass("h-foldClose"); } }); }catch(e){ } /*价格查询弹框*/ //if($(".h-selectCity input").length>0){ // $(".h-selectCity input").on("click",function(event){ // event.stopPropagation(); // /*选择城市框的宽度*/ // var cityWid = $(".h-selectCity").width(); // $(".h-provinceCity").width(cityWid-2); // var o=$(this).offset(); // var l=o.left; // var t=o.top; // var h=$(this).outerHeight()+1; // $(".h-provinceCity").css("top",t+h-1).css("left",l); // if($(".h-provinceCity").is(":visible")){ // $(".h-provinceCity").hide(); // $(this).removeClass("h-txtActive"); // }else{ // $(".h-provinceCity").show(); // $(this).addClass("h-txtActive"); // } // }); //} //$(".h-provinceCity").siblings().on("click",function(event){ // event.stopPropagation(); // $(".h-provinceCity").hide(); // $(".h-selectCity input").removeClass("h-txtActive"); //}); /*加盟合作加盟内页跳转*/ //$(".h-nextBtn").click(function(){ // $(this).parent().parent().parent().find(".h-allianceCon:eq(1)").show().siblings().hide(); //}); //$(".h-prevBtn").click(function(){ // $(this).parent().parent().parent().find(".h-allianceCon:eq(0)").show().siblings().hide(); //}); try{ /*登录页面切换banner*/ $(".h-loginBanner .h-loginBox ul li").on("click",function(){ //$(this).addClass("h-loginActive").siblings().removeClass("h-loginActive"); var index = $(this).index(); if(index==0){ $(".h-loginBanner").addClass("h-corporate").removeClass("h-userlogin"); }else{ $(".h-loginBanner").addClass("h-userlogin").removeClass("h-corporate"); } }); $(".h-loginBox ul li").on("click",function(){ $(this).addClass("h-loginActive").siblings().removeClass("h-loginActive"); }); /*注册页面tab切换*/ $(".h-registTab ul li").on("click",function(){ $(this).addClass("h-rTabactive").siblings().removeClass("h-rTabactive"); }); }catch(e){ } /*tab切换*/ //$(".h-tabcommon ul li").on("click",function(){ // var index = $(this).index(); // $(".h-tabCon3 .h-tabConin3:eq("+index+")").show().siblings().hide(); // $(this).find("a").addClass("h-tabActive"); // $(this).siblings().find("a").removeClass("h-tabActive"); //}); });