var ismobile = false, mobile = false, win_width = 0, win_height = 0, navitem = 0, ath = 90, $menubtn = jquery('.menu-handler'), $menuoverlay = jquery('.menu-overlay'), menum = jquery(".menumoblie"), pagenavnum = 0, scrollnav = 0; var pageinit = { init: function() { win_width = $(window).width(); win_height = $(window).height(); if(win_width <= 1200) { ismobile = true; ath = 54; } else if(win_width > 1200) { ismobile = false; ath = 86; menu.close(); }; }, setimgmax: function(img, imgw, imgh, tw, th) { var twidth = tw || win_width; var theight = th || win_height; var coe = imgh / imgw; var coe2 = theight / twidth; if(coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; }, setscroll: function(anchorcur) { if(jquery(anchorcur).length >= 1) { jquery("html,body").animate({ scrolltop: jquery(anchorcur).offset().top - ath }, 0); } }, setermbox: function(obj, title) { obj.click(function() { var str = '
' + title + '
'; $("body").append(str); jquery(".ermsblack").fadein(); jquery(".ermsbox").animate({ margintop: "-132" }, 400); $(".ermsbox .close").click(function() { $(".ermsblack").remove(); }); jquery(".ermsblack").click(function() { $(".ermsblack").remove(); }); return false; }) }, setsplit: function(el) { var n = el; for(var e = 0, t = n.length; e < t; e++) { var a = n[e], r = a.textcontent.trim(); a.innerhtml = ""; i(a, r) } function i(n, e) { for(var t in e) { var a = document.createelement("span"); a.innerhtml = e[t] === " " ? " " : e[t]; n.appendchild(a); } } }, settimedelay: function(el, time, delay, reverse) { var _span = el; _span.each(function(i) { var _i = $(this).find('span'); _i.each(function(j) { if(reverse) { j = _i.length - j - 1; } $(this).css({ 'animation-delay': delay + time * j + 'ms', '-webkit-animation-delay': delay + time * j + 'ms' }) }) }) }, showbox: function(htmladdress) { $.ajax({ url: htmladdress, datatype: "html", success: function(data) { if(data == "" || data == null) { return; } else { if(jquery(".md-modal").length >= 1) { jquery('html').removeclass('md-show'); jquery('.md-modal').remove(); }; $("body").append( '
' ); $('.md-modal .vertical-inner').append(data); settimeout(function() { $("html").addclass("md-show"); }, 50); jquery('.form-box-close').bind('click', function(e) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); }); jquery('.md-modal .vertical-inner').bind('click', function(e) { if($(e.target).hasclass('vertical-inner')) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); } }); } }, error: function(xmlhttprequest, textstatus, errorthrown) { jquery('html').removeclass('md-show'); settimeout(function() { jquery('.md-modal').remove(); }, 400); } }); }, pbanner: function() {} }, nav = { init: function() {} }, menu = { init: function() { jquery(".menu-handler").click(function() { if(navitem == 0) { jquery(this).addclass("active"); jquery("html").addclass("menuopen"); navitem = 1; } else { jquery(this).removeclass("active"); jquery("html").removeclass("menuopen"); navitem = 0; } }); $(document).on("click", ".hblist .hlyj", function(e) { var mnavcur = $(this); var mnavbox = $(this).parents("li"); if(mnavbox.find(".hlb").length > 0) { if(mnavbox.hasclass("cur")) { mnavbox.find(".hlb").stop(false, false).slideup(); mnavbox.removeclass("cur"); } else { jquery(".hblist li").removeclass("cur"); jquery(".hlb").stop(false, false).slideup(); mnavbox.find(".hlb").stop(false, false).slidedown(); mnavbox.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", ".hblist a", function(e) { var $this = jquery(this); var hash = $this.attr("href").split("#")[1]; if(hash && jquery("#" + hash).length >= 1) { e.preventdefault(); jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - ath }, 0); menu.close(); } }); $(".pusher-black").click(function() { if(navitem == 1) { menu.close(); }; }); }, close: function() { $menubtn.removeclass("active"); jquery("html").removeclass("menuopen"); navitem = 0; } }, pbanner = { init: function() {} }, pagenav = { init: function() { jquery(".mdw").click(function(e) { var $this = jquery(this); var hash = $this.attr("href").split("#")[1]; if(hash && jquery("#" + hash).length >= 1) { e.preventdefault(); jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - ath }, 600, 'easeinoutexpo'); } }); } }; jquery(window).resize(function() { pageinit.init(); pbanner.init(); }); pageinit.init(); $(document).ready(function() { nav.init(); menu.init(); pbanner.init(); pagenav.init(); pageinit.setermbox(jquery('.ermitem'), "扫描此二维码关注我们"); }); $(window).on('load', function() { $(".nywz").addclass('active'); var head_height = $(".header").height(); var hash = location.href.split("#")[1]; if(hash) { jquery("html,body").animate({ scrolltop: jquery("#" + hash).offset().top - head_height }, 600); } }); var index_head = $(".yj-bot li.active").index(); var length_ = $(".yj-bot li.active").length; $(".yj-bot li").hover(function() { var yb_index = $(this).index(); $(this).addclass("active").siblings().removeclass('active'); }).mouseleave(function() { if(length_ > 0) { $(".yj-bot li").removeclass('active').eq(index_head).addclass('active'); } else { $(".yj-bot li").removeclass('active'); } }); // 底部select $(".fs-select").click(function() { $(".fs-zk").slidetoggle(300); }).mouseleave(function() { $(".fs-zk").slideup(300); }); // 头部菜单 $(".hrmenu").click(function() { $(".head-zk").addclass('active'); }); $(".hbclose,.otgb").click(function() { $(".head-zk").removeclass('active'); }); // 资质荣誉 //jquery(".ahbanner").slick({ // slidestoshow: 1, // slidestoscroll: 1, // centerpadding: '0', // arrows: false, // speed: 400, // dots: true, // infinite: true, // centermode: false, // autoplay: false, // focusonselect: true //}); // 品质保证 jquery(".mb2banner").slick({ slidestoshow: 3, slidestoscroll: 3, centerpadding: '0', arrows: true, speed: 400, dots: true, infinite: true, centermode: false, autoplay: false, focusonselect: true }); jquery(".mb3zs").slick({ slidestoshow: 4, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 400, dots: false, infinite: true, centermode: true, autoplay: false, focusonselect: false, responsive: [{ breakpoint: 1024, settings: { slidestoshow: 3, slidestoscroll: 1, } }, { breakpoint: 480, settings: { slidestoshow: 2, slidestoscroll: 1, } } ] }); // 智能装备 jquery(".mr2banner").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 400, dots: false, infinite: true, centermode: false, autoplay: false, focusonselect: true, asnavfor: '.mr2small' }); jquery(".mr2small").slick({ slidestoshow: 5, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 400, dots: false, infinite: true, centermode: false, autoplay: false, focusonselect: true, asnavfor: '.mr2banner', responsive: [{ breakpoint: 640, settings: { slidestoshow: 3, slidestoscroll: 1, } }] }); // 二级菜单栏目 var index_im = $(".insides-menu a.active").index(); var length_im = $(".insides-menu a.active").length; $(".insides-menu a").hover(function() { var il_index = $(this).index(); $(this).addclass("active").siblings().removeclass('active'); }).mouseleave(function() { if(length_im > 0) { $(".insides-menu a").removeclass('active').eq(index_im).addclass('active'); } else { $(".insides-menu a").removeclass('active'); } }); // 产品中心 jquery(".pbanner1").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 400, dots: false, infinite: true, centermode: false, autoplay: false, focusonselect: true, asnavfor: '.pbanner2' }); jquery(".pbanner2").slick({ slidestoshow: 6, slidestoscroll: 1, centerpadding: '0', arrows: false, speed: 400, dots: false, infinite: true, centermode: false, autoplay: false, focusonselect: true, asnavfor: '.pbanner1', responsive: [{ breakpoint: 640, settings: { slidestoshow: 4, slidestoscroll: 1, } }] });