var ismobile = false, mobile = false, win_width = 0, win_height = 0, navitem = 0, ath =65, $menubtn = jquery('.menu-handler'), 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 =65; 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; }) }, openbox: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); } }); } }, nav={ init:function(){ jquery(".nav li").hover(function () { if (jquery(this).find(".subnav").length > 0) { $(this).children("a").addclass("hov"); $(this).find(".subnav").stop(false, false).animate({top:"100%","opacity":"show"},350); }; }, function () { $(this).children("a").removeclass("hov"); $(this).children(".subnav").stop(false, false).fadeout(250,function(){$(this).css("top","70%");}); }); jquery(".pagenav a,.nav .subnav 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'); if(ismobile){ jquery(this).parent().fadeout(); } } }); } }, 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('.pbanner').length>=1){ if (!ismobile) { jquery('.pbanner').css("height", win_height-ath); pageinit.setimgmax(jquery(".pbanner .load-img"),1680,702,win_width,win_height-ath); }else { jquery('.pbanner').css("height", "auto"); } settimeout(function() { jquery(".pbanner .imgbox").addclass("active"); }, 50); jquery(window).scroll(function () { var stop = $(window).scrolltop(); if (stop < win_height && !ismobile) { jquery('.pbanner .load-img1').css({ 'transform': "translate(0px,-" + (stop) / 90 + "%)", '-webkit-transform': "translate(0px,-" + (stop) / 90 + "%)" }); } }); } } }, pagenav={ init:function(){ jquery(".page-nav-btn 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() }); } }); } } }, dock = { init: function () { jquery(".dockcon li").mouseenter(function () { jquery(this).find(".con").stop(false, false).animate({ right: 60, "opacity": "show" }, 300); }).mouseleave(function () { jquery(this).find(".con").stop(false, false).animate({ right: 0, "opacity": "hide" }, 300); }); } },searchbox={ opensearch:function(){ $(".search-ibox").stop().fadein(); $("body,html").addclass('ovh'); }, closesearch:function(){ $(".search-ibox").stop().fadeout(); $("body,html").removeclass('ovh'); } }; 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'), "扫描此二维码关注我们"); dock.init(); jquery(".backtop").bind("click", function () { jquery('html, body').stop(false, false).animate({ scrolltop: 0 }, 800, 'easeinoutexpo'); }); var useragent = navigator.useragent; var isie = useragent.indexof("compatible") > -1 && useragent.indexof("msie") > -1; //判断是否ie<11浏览器 var fieversion = -1; if (isie) { var reie = new regexp("msie (\\d+\\.\\d+);"); reie.test(useragent); fieversion = parsefloat(regexp["$1"]); } if (fieversion === -1 || fieversion > 9 && jquery(".pbanner").length>=1) { $('.pbanner-c .zh').animatext({ speed: 120, effect: 'flipinx', reverse: false }); $('.pbanner-c .en').animatext({ speed: 110, effect: 'zoomin', reverse: false }); } var tnum= { getstatus: function(e) { var t = window.getcomputedstyle(e.get(0)), o = t.getpropertyvalue("-webkit-transform") || t.getpropertyvalue("transform"); "none" === o && (o = "matrix(0,0,0,0,0)"); var n = o.match(/([-+]?[\d\.]+)/g); return n[14] || n[5] || 0 } }, n = { parastart: new array, amount: 7, s: { timer: [] } }; for (var o = 0; o < jquery(".js__mv").length; o++) { var a = jquery(".js__mv").eq(o), s = { $s: a.find(".inner")[0] ? a : a.parents(".section-container"), h: 0, p: 0 }; s.h = s.$s.height(), s.p = s.$s.offset().top; a.offset().top + win_height + s.h; n.parastart[o] = { thisposi: number(a.offset().top - s.$s.offset().top) / n.amount, parentposi: s.$s.offset().top } } jquery(window).scroll(function () { var windowtop = $(window).scrolltop(); if(windowtop>100){ jquery(".dockcon .last").stop(false,false).addclass("showme"); }else{ jquery(".dockcon .last").stop(false,false).removeclass("showme"); }; for (var i = 0; i < jquery(".js__mv").length; i++) { var r = jquery(".js__mv").eq(i); var c =windowtop + number(n.parastart[i].parentposi + n.parastart[i].thisposi), l = c * r.data("ratio") / n.amount; if (ismobile) return; tweenmax.to(r, .35, { y: l,ease: 'easeoutquad'}); } }); jquery(".scroll-bot").bind("click", function() {jquery('html, body').stop().animate({scrolltop: win_height-ath}, 600,'easeinoutexpo');}); }); jquery(".vwrap .close,.vwrap .videobtg").click(function () { jquery(".vwrap").hide(); $('#videobox').html(""); }); $(window).on('load',function(){ var hash = location.href.split("#")[1]; if (hash) { pageinit.setscroll("#" + hash); } })