//导航 //超过一定高度导航添加类名 var nav = $("#header"); //得到导航对象 var win = $(window); //得到窗口对象 var sc = $(document); //得到document文档对象。 win.scroll(function () { if (sc.scrollTop() >= 100) { nav.addClass("on"); } else { nav.removeClass("on"); } }); $(window).load(function () { function configIframe() { var headerH = $("#header").height(); var navH = $("#nav").height(); if (matchMedia("only screen and (max-width:880px)").matches) { navH = 0; } //$('#banner').css('margin-top',headerH+navH); //$('.ny_banner').css('margin-top',headerH+navH); var navToggleH = $("#navToggle").outerHeight(); $("#navToggle").css("margin-top", -navToggleH / 2); var logo_descH = $(".logo_desc").outerHeight(); logo_descH = headerH - logo_descH; $(".logo_desc").css("margin-top", logo_descH / 2); /*MK(中国)产品滚动*/ var w = $(window).width(); var vis = 1; if (w >= 1200) { vis = 1; } else if (w <= 1199 && w > 880) { vis = 1; } else if (w <= 880 && w > 380) { vis = 1; } else if (w <= 380) { vis = 1; } var pro_bdW = $(".product .bd").width(); var pro_LiW = (pro_bdW - 30 * vis) / vis; $(".product .bd li").width(pro_LiW); //document.getElementById("swidth").innerHTML=vis; jQuery(".product").slide({ mainCell: ".bd ul", autoPage: true, effect: "left", autoPlay: true, vis: vis, trigger: "click", }); } configIframe(); /*窗口改变事件*/ window.onresize = function () { /*window.location.reload();*/ configIframe(); }; //移动端展开nav // $("#navToggle").on("click", function () { // $("#nav").addClass("open"); // }); //关闭nav // $("#nav .top .closed").on("click", function () { // $("#nav").removeClass("open"); // }); //移动端展开nav // $("#navToggle").on("click", function () { // $("#nav2").addClass("open"); // }); //关闭nav // $("#nav2 .top .closed").on("click", function () { // $("#nav2").removeClass("open"); // }); //二级导航 移动端 /*$(".m_nav .ul li").click(function() { $(this).children("div.dropdown_menu").slideToggle('slow') $(this).siblings('li').children('.dropdown_menu').slideUp('slow'); });*/ }); $(function () { $(".topBar .s").hover(function () { $(this).find(".sub").stop().slideToggle(); }); }); if ($(window).width() > 991) { $(".dropdown").hover( function () { $(this).addClass("open"); }, function () { $(this).removeClass("open"); } ); } else { $(".dropdown") .find(".arr") .on("click", function () { $(this).parent().toggleClass("open"); }); } $(".lanmu") .find(".arr") .on("click", function () { $(this).parent().toggleClass("open"); }); /*联系方式tab切换*/ $(".contact .tags_title .one").hover( function () { $(this).removeClass("ron"); $(".contact .tags_title .two").addClass("ron"); $(".contact .content2").hide(); $(".contact .content1").show(); }, function () {} ); $(".contact .tags_title .two").hover( function () { $(this).removeClass("ron"); $(".contact .tags_title .one").addClass("ron"); $(".contact .content1").hide(); $(".contact .content2").show(); }, function () {} ); /* -----QQ 侧边悬浮 ---- */ $(".suspension .a").bind("mouseenter", function () { var _this = $(this); var s = $(".suspension"); var isService = _this.hasClass("a-service"); var isServicePhone = _this.hasClass("a-service-phone"); var isQrcode = _this.hasClass("a-qrcode"); if (isService) { s.find(".d-service").show().siblings(".d").hide(); } if (isServicePhone) { s.find(".d-service-phone").show().siblings(".d").hide(); } if (isQrcode) { s.find(".d-qrcode").show().siblings(".d").hide(); } }); $(".suspension, .suspension .a-top").bind("mouseleave", function () { $(".suspension").find(".d").hide(); }); $(".suspension .a-top").bind("mouseenter", function () { $(".suspension").find(".d").hide(); }); $(".suspension .a-top").bind("click", ".suspension .a-top", function () { $("html,body").animate({ scrollTop: 0 }); }); $(window).scroll(function () { var st = $(document).scrollTop(); var $top = $(".suspension .a-top"); if (st > 400) { $top.css({ display: "block" }); } else { if ($top.is(":visible")) { $top.hide(); } } }); // https://davidwalsh.name/query-string-javascript function getUrlParameter(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } $(function () { $("#xcy-mobile-nav .nav-item .title").on("click", function () { $(this).parent().toggleClass("is-open"); return false; }); $("#xcy-mobile-nav .close").on("click", function () { $(this).parent().toggle(); return false; }); $("#navToggle").on("click", function () { $("#xcy-mobile-nav").toggle(); }); });