var ismobile = false, mobile = false, win_width = 0, win_height = 0, navitem = 0, ath = 80, $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 <= 1024) { ismobile = true; ath = 54; } else if(win_width > 1024) { 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() { if(jquery('.pbanner').length >= 1) { if(!ismobile) { jquery('.pbanner').css("height", jquery(".pbanner .load-img").height()); } else { jquery('.pbanner').css("height", "auto"); } }; jquery('.pbanner-c .en,.pbanner-c .zh').each(function(i) { pageinit.setsplit(jquery(this)); pageinit.settimedelay($(this), 80, 350, false); }); } }, 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() { if(jquery(".load-img").length >= 1) { _preloadimg([ jquery(".load-img").attr("src") ], function() { pageinit.pbanner(); }); jquery(window).resize(function() { pageinit.pbanner(); }); } } }, pagenav = { init: function() { jquery(".insidetab 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 }, 800, 'easeinoutexpo'); } }); var $sec_nav = $('.page-nav-box'); if($sec_nav.length) { var $sec_n = $sec_nav.find('.page-nav-btn'), $current_item = $sec_nav.find('.active').parent(); if(ismobile && $current_item.length >= 1) { $sec_n.stop().animate({ scrollleft: $current_item.position().left }); } $(window).resize(function() { if(ismobile && $current_item.length >= 1) { $sec_n.stop().animate({ scrollleft: $current_item.offset().left + $sec_n.scrollleft() }); } }); } } }; 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 }, 500); } }); // 头部 var index_head = $(".yj-bot li.active").index(); var length_ = $(".yj-bot li.active").length; $(".yj-bot li").hover(function() { $(this).addclass("active").siblings().removeclass('active'); }, 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 = $(".ipt-link a.active").index(); var now = $(".ipt-link a").width() * indexs; $(".inside-pages-tab").animate({ scrollleft: now }); }); jquery(window).scroll(function() {}); // 点击下拉图标 jquery(".mousebox").bind("click", function() { // var topheight = $(".header").outerheight(); var downheight = $(".banner-wrap").outerheight(); jquery('html, body').stop().animate({ scrolltop: downheight }, 600, 'easeinoutexpo'); }); // 发展历程 jquery(".dhbanner").slick({ slidestoshow: 3, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 500, dots: true, infinite: false, centermode: false, autoplay: false, focusonselect: true, responsive: [{ breakpoint: 860, settings: { slidestoshow: 2, slidestoscroll: 1, } }, { breakpoint: 551, settings: { slidestoshow: 1, slidestoscroll: 1, } }] }); // 新闻中心 jquery(".ncbanner").slick({ slidestoshow: 1, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 500, dots: true, infinite: true, centermode: false, autoplay: true, focusonselect: true // responsive: [{ // breakpoint: 860, // settings: { // slidestoshow: 2, // slidestoscroll: 1, // } // }, { // breakpoint: 551, // settings: { // slidestoshow: 1, // slidestoscroll: 1, // } // }] }); $(".tbtab a").click(function() { var it3_index = $(this).index(); $(this).addclass('active').siblings().removeclass('active'); $('.trlist .tlz').eq(it3_index).show().siblings().hide(); }); // 人才培训 jquery(".trainingbanner").slick({ slidestoshow: 3, slidestoscroll: 1, centerpadding: '0', arrows: true, speed: 500, dots: true, infinite: true, centermode: false, autoplay: true, focusonselect: true, responsive: [{ breakpoint: 860, settings: { slidestoshow: 2, slidestoscroll: 1, } },{ breakpoint: 640, settings: { slidestoshow: 1, slidestoscroll: 1, } } ] });