;(function($, window, document,undefined) { "use strict"; var Tfn = function() { this.header = $('header'), this.center = $('#wrapper'), this.footer = $('footer'), this.IEnum = null;//濡傛灉鏄痠e娴忚鍣紝ie鐨勭増鏈暟 this.isAnimating = false,//鍒ゆ柇杞挱鍔ㄧ敾鏄惁杩涜涓 this.isAnimating1 = false,//鍒ゆ柇涓嬫媺鍔ㄧ敾鏄惁杩涜涓 this.aniTime = 600, //鍔ㄧ敾鏃堕棿 this.isMobile = false, //鍖哄垎绉诲姩绔笌PC绔 this.mobile = false, //鍖哄垎鎵嬫満绔笌骞虫澘 this.windowWidth = ('innerWidth' in window) ? window.innerWidth : document.documentElement.clientWidth, this.windowHeight = ('innerHeight' in window) ? window.innerHeight : document.documentElement.clientHeight, this.rowNode = [],//椤甸潰鍧楄妭鐐瑰瓨鍌 this.appDirection = null;//鎵嬫満绔Е鎽告粦鍔ㄦ柟鍚 }; Tfn.prototype = { //鍒濆鍖 init: function() { var self = this; if (!!window.ActiveXObject || "ActiveXObject" in window){ $('body').addClass("ie"); this.IEnum = parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE","")); if(this.IEnum<9){ alert("鎮ㄧ殑娴忚鍣ㄧ増鏈繃浣庯紝璇蜂笅杞絀E9鍙婁互涓婄増鏈?);return false; }else if(this.IEnum==9){ $('body').addClass("ie9"); }else if(this.IEnum==10){ $('body').addClass("ie10"); }else if(this.IEnum==11){ $('body').addClass("ie11"); } } // this.storage(); imagesLoaded(document.querySelectorAll('img'), function () { }); self.version(); //self.getSroll(); self.getScreens(); self.setScroll(); self.getMenuHover(); self.setInnerBanner(); self.setMessgePop(); self.setPopUp($('.weix'), "寰俊鍏紬鍙?); self.videoShow(); if(!this.isMobile){ $('.bitem-span').each(function(i) { self.setSplit($(this)); self.setTimeDelay($(this), 80, 250, false); }) } }, // 娴忚鍣ㄧ増鏈 version:function(){ var explorer = window.navigator.userAgent ; if (explorer.indexOf("MSIE") >= 0||explorer.indexOf("Trident")>0 ) { if(explorer.indexOf("MSIE 5")>0||explorer.indexOf("MSIE 6")>0||explorer.indexOf("MSIE 7")>0||explorer.indexOf("MSIE 8")>0) { return 'LowerIEVersion'; }else{ return 'EdgeOrTrident'; } } else if (explorer.indexOf("Maxthon") >= 0) {return 'Maxthon';} else if (explorer.indexOf("Firefox") >= 0) {return 'FireFox';} else if(explorer.indexOf("Chrome") >= 0){ return 'Chrome';} else if(explorer.indexOf("Opera") >= 0){ return 'Opera';} else if(explorer.indexOf("Safari") >= 0){ return 'Safari';} }, getSroll: function(){ function init(){ new SmoothScroll(document,120,20) } function SmoothScroll(target, speed, smooth) { if (target === document) target = (document.scrollingElement || document.documentElement || document.body.parentNode || document.body) // cross browser support for document scrolling var moving = false var pos = target.scrollTop var frame = target === document.body && document.documentElement ? document.documentElement : target // safari is the new IE target.addEventListener('mousewheel', scrolled, { passive: false }) target.addEventListener('DOMMouseScroll', scrolled, { passive: false }) function scrolled(e) { if (!$('body').is('.show')){ if (!$('.about-box').length > 0){ e.preventDefault(); // disable default scrolling var delta = normalizeWheelDelta(e) pos += -delta * speed pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight)) // limit scrolling if (!moving) update() } } } //top btn $('.scroll-top').on('click', function(e){ e.preventDefault(); pos = 0; $('html, body').animate({ scrollTop:'0' },1200, 'easeInOutExpo'); return false; }); var hash = location.hash; jQuery(".navs-menu li > a").click(function(e){ var hash=jQuery(this).attr("href").split("#")[1]; if(hash && jQuery("#"+hash).length==1){ setScroll("#"+hash); } }); function getHashs(){ if(hash){ setScroll(hash); } }; var scnum=0; function setScroll(anchorCur){ $("body").stop().removeClass("slideDown"); scnum=$('.header').outerHeight(); pos = jQuery(anchorCur).offset().top -scnum; jQuery("html,body").animate({ scrollTop: parseInt(jQuery(anchorCur).offset().top) -scnum},400); }; window.onload = function(){ getHashs(); } function doNotReload(){ if(event.keyCode == 116) { target.scrollTop = 0; pos = 0;} } document.onkeydown = doNotReload; function normalizeWheelDelta(e){ if(e.detail){ if(e.wheelDelta) return e.wheelDelta/e.detail/40 * (e.detail>0 ? 1 : -1) // Opera else return -e.detail/3 // Firefox }else return e.wheelDelta/120 // IE,Safari,Chrome } function update() { moving = true var delta = (pos - target.scrollTop) / smooth target.scrollTop += delta if (Math.abs(delta) > 0.5) requestFrame(update) else moving = false } var requestFrame = function() { // requestAnimationFrame cross browser return ( window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(func) { window.setTimeout(func, 1000 / 50); } ); }() } init(); }, getScreens: function(){ var self = this; var mtop = $(".mtop").height(); if (this.windowWidth <= 1024) { this.isMobile = true; } else if (this.windowWidth > 1024) { this.isMobile = false; }; //鍖哄垎鎵嬫満绔拰骞虫澘 if (this.windowWidth <= 640) { this.mobile = true; } else if (this.windowWidth > 640) { this.mobile = false; }; function initBox() { self.windowWidth = ('innerWidth' in window) ? window.innerWidth : document.documentElement.clientWidth, self.windowHeight = ('innerHeight' in window) ? window.innerHeight : document.documentElement.clientHeight, $('.innerbanner,.innerbanner figure').css('height',self.windowHeight - mtop); setImgMax($('.innerbanner figure img'), 1920, 910, self.windowWidth, self.windowHeight - mtop); }; //initBox(); jQuery(window).resize(function () { //initBox(); }); }, setScroll: function() { var self = this; function a(){ var s = $(window).scrollTop(); s > 30 ? $(".header").addClass('scroll'): $(".header").removeClass('scroll'); s > self.windowHeight ? $(".flex-menu").addClass('flex'): $(".flex-menu").removeClass('flex'); } $(window).scroll(a); a(); }, getMenuHover: function() { var index_ = $(".navs >li.active").index(); if(!this.isMobile){ $(".navs > li").hover(function () { $(this).addClass("active").siblings().removeClass("active"); $(this).find(".navs-menu").stop().slideDown(); },function(){ $(this).find(".navs-menu").stop().slideUp(); $(".navs > li").eq(index_).addClass("active").siblings().removeClass("active"); }); } $('.menubtn').on('click', function(e) { e.stopPropagation(); $(this).toggleClass('active'); $(".header-navs").stop().toggleClass("show"); }); }, setInnerBanner: function() { var self = this; // jQuery(window).scroll(function () { // var windowTop = jQuery(window).scrollTop(); // if (windowTop < self.windowHeight) { // jQuery('.pbanner figure,.banner-slide figure').css('transform', "translate(0px," + (windowTop) / 2.8 + "px)"); // }; // }); if($(".inner-title").length> 0){ var s1 = new TimelineMax(); $(".inner-title small").css('opacity','1'); $(".inner-title strong").css('opacity','1'); $(".inner-title strong").textillate({in: {effect: 'fadeInUp',delayScale: 2 }}); $(".inner-title small").textillate({in: {effect: 'flip'}}); s1.fromTo(".pbanner>figure img", 6, {scale: 1.08},{scale: 1}); } if($("img.lazy").length > 0){ $("img.lazy").lazyload({ effect: "fadeIn", placeholder: "images/loading.gif" }) } }, setMessgePop: function () { $(".contact-btn").click(function(){ $(".poo-message").addClass("show"); }); $(".pop-bgs,.pop-close").click(function(){ $(".poo-message").removeClass("show"); }); }, setPopUp: function(obj, title) { obj.click(function() { var str = '
'; $("body").append(str); jQuery(".popUpblack").fadeIn(); jQuery(".popUp").animate({ marginTop: "-127" }, 400); $(".popUp .close").click(function() { $(".popUpblack").remove(); }); jQuery(".popUpblack").click(function() { $(".popUpblack").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' }) }) }) }, videoShow: function () { $(".video-sbtn").click(function () { var videoName = $(this).data('url'), coloseIco = $(this).data('ico'); $(".videon").attr("src", videoName); $(".pv-close").text( coloseIco); $(".pvideo-bg").addClass("overlay"); }); $(".pv-close").click(function () { $(".pvideo-bg").removeClass("overlay"); $(".videon").attr("src", ""); }); $(".vwrap .close,.vwrap .videobtg").click(function () { $(".vwrap").hide(); $('#videobox').html(""); }); } } $.fn.myFn = function() { new Tfn().init(); }; })(jQuery, window, document); $(document).myFn(); jQuery(window).load(function() { jQuery('.article-block').delay(500).scrollClass(); }); // window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)]; function setImgMax(img, imgW, imgH, tW, tH) { var tWidth = tW || w_width; var tHeight = tH || w_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 }); }; };