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(".sm-content").length >= 1) { jquery('html').removeclass('sm-show'); jquery('.sm-content').remove(); }; $('.sm-modal .vertical-inner').append(data); $("html").addclass("sm-showb"); settimeout(function() { $("html").addclass("sm-show"); }, 50); jquery('.sm-close').bind('click', function(e) { jquery('html').removeclass('sm-show'); settimeout(function() { $("html").removeclass("sm-showb"); jquery('.sm-content').remove(); }, 400); }); jquery('.sm-modal .vertical-inner').bind('click', function(e) { if($(e.target).hasclass('vertical-inner')) { jquery('html').removeclass('sm-show'); settimeout(function() { $("html").removeclass("sm-showb"); jquery('.sm-content').remove(); }, 400); } }); } }, error: function(xmlhttprequest, textstatus, errorthrown) { jquery('html').removeclass('sm-show'); settimeout(function() { $("html").removeclass("sm-showb"); jquery('.sm-content').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", ".menumoblie .nav-link", function(e) { var mnavcur = $(this); var mnavbox = $(this).parents("li"); if(mnavbox.find(".subnav").length > 0) { if(mnavbox.hasclass("cur")) { mnavbox.find(".subnav").stop(false, false).slideup(); mnavbox.removeclass("cur"); } else { jquery(".menumoblie li").removeclass("cur"); jquery(".subnav").stop(false, false).slideup(); mnavbox.find(".subnav").stop(false, false).slidedown(); mnavbox.addclass("cur"); e.preventdefault(); } } }); $(document).on("click", ".menumoblie 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(".insides-tab a").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() { 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'); $(".ej-menu").slidedown(300); $('.ej-menu .em-l').eq(yb_index).addclass("active").siblings().removeclass("active"); $(".hrs-k").removeclass("active"); }); $(".ej-menu .em-l").hover(function() { var em_index = $(this).index(); $(this).addclass("active").siblings().removeclass('active'); $('.yj-bot li').eq(em_index).addclass("active").siblings().removeclass("active"); $(".hrs-k").removeclass("active"); }); $('.nav-menu').mouseleave(function() { $(".ej-menu").slideup(300); }); $('.header').mouseleave(function() { if(length_ > 0) { $(".yj-bot li").removeclass('active').eq(index_head).addclass('active'); } else { $(".yj-bot li").removeclass('active'); } }); // 内页tab定位 jquery(function() { // var indexs = $(".ictab a.active").index(); // var now = $(".ictab a").width() * indexs; // $(".inside-pages-tab").animate({ // scrollleft: now // }); }); // 产业 jquery(".industry-banner").slick({ slidestoshow: 4, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 800, dots: false, infinite: false, centermode: false, autoplay: false, focusonselect: true, responsive: [{ breakpoint: 1024, settings: { slidestoshow: 3, slidestoscroll: 1, } }, { breakpoint: 640, settings: { slidestoshow: 2, slidestoscroll: 1, } }, { breakpoint: 421, settings: { slidestoshow: 1, slidestoscroll: 1, } } ] }); // 头部搜索 $('.hrs').hover(function() { $(".hrs-k").addclass("active"); }); $('.nav').mouseleave(function() { $(".hrs-k").removeclass("active"); }); // 点击底部滚动到顶部 $('.up-top').click(function() { $('html,body').animate({ scrolltop: '0px' }, 800); });