var isTouch = Modernizr.touch, isMobile = false, //鍖哄垎绉诲姩绔笌PC绔 mobile = false, //鍖哄垎鎵嬫満绔笌骞虫澘 w_width = 0, w_height = 0, bannerImgh = 638, navItem = 0, h_height = 0, roll = 0, sTop = 150, produs = 0, ST = 0; var _mousemove; var _click; var _mousedown; var _mouseup; //绉诲姩绔簨浠跺拰PC浜嬩欢鐨勫垏鎹 if (Modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pageBox() { w_width = jQuery(window).width(); w_height = jQuery(window).height(); //璁剧疆绉诲姩绔弬鏁 if (w_width <= 1024) { isMobile = true; } else if (w_width > 1024) { isMobile = false; }; //鍖哄垎鎵嬫満绔拰骞虫澘 if (w_width <= 640) { mobile = true; } else if (w_width > 640) { mobile = false; }; $(".pbanners figure").height(w_height); setImgMax($('.pbanners figure img'), 1920, 960, w_width, w_height); } pageBox(); jQuery(window).resize(function() { pageBox(); }); var pageFn = { init: function(){ this.getScrollColor(); this.getNavs(); this.cursorFollow(); this.setInnerBanner(); this.getHash(); this.getScrollTop(); this.loader(); }, loader: function(){ $(window).ready(function(){ if($(".loader").length < 0){ setTimeout(function(){ $(".loader").addClass("active") },0); var demo = {score:0}, scoreDisplay = document.getElementById("scoreDisplay"); var tween = TweenLite.to(demo,4,{ score:100, onUpdate:showScore }) function showScore() { scoreDisplay.innerHTML = demo.score.toFixed(0); } setTimeout(function() { TweenLite.to($(".loader"), 0.6, {opacity:0,display: "none"}); },300) } }); isNewVisitor(); function isNewVisitor() { // 浠巆ookie璇诲彇鏍囪瘑 var flg = getCookie("visited"); if (flg !="new") { setCookie("visited","new", 5); $(".loader").css("display","block"); }else { $(".loader").css("display","none"); } } // 鍐欏瓧娈靛埌cookie function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires +";path=/"; } // 璇籧ookie function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i 30 ? $(".header").addClass('header2'): $(".header").removeClass('header2'); } $(window).scroll(a); a(); }, cursorFollow: function(e) { if ($(window).width() > 1024) { $(".navs__pop").on('mousemove', function(e) { var clientX = e.clientX, clientY = e.clientY; var scrollLeft = $(this).scrollLeft(), scrollTop = $(this).scrollTop(); var left = clientX + scrollLeft, top = clientY + scrollTop; myTween = TweenLite.to($('.Circles-circle'), 1, { x: left, y: top }); }) } }, setInnerBanner: function() { $("img.lazy").lazyload({ effect: "fadeIn", threshold: 10, placeholder: "images/loading.gif" }); jQuery(window).scroll(function () { var windowTop = jQuery(window).scrollTop(); if (windowTop < w_height) { jQuery('.pbanner figure img').css('transform', "translate(0px," + (windowTop) / 3 + "px)"); }; }); if($(".ptext").length> 0){ pban1 = new SplitText($('.ptext strong,.ptext p'), {type: "chars"}); pban2 = new SplitText($('.ptext small'), {type: "chars"}); var s1 = new TimelineMax(); s1.fromTo(".pbanner figure", 5, {scale: 1.1},{scale: 1}); s1.staggerFrom(pban2.chars, 0.4, {autoAlpha:0, scale:4, force3D:true}, 0.01, 1); s1.staggerFrom(pban1.chars, 0.8, {y: 260, ease: Expo.easeOut},0.05, 0.8); } }, getHash: function() { var hash = location.hash; jQuery(".laval-menu-list 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){ if($(".manage").length > 0){ return; } scnum=$('.header').outerHeight(); jQuery("html,body").animate({ scrollTop: parseInt(jQuery(anchorCur).offset().top) -scnum},800); }; getHashs(); setTimeout(function(){ getHashs(); },50) }, getScrollTop: function(){ $(".news-scolltop").click(function(){ jQuery("html,body").animate({ scrollTop: 0},800); }); $(".pbanner__text .nMore").click(function(){ jQuery("html,body").animate({ scrollTop: w_height},800); }); } } pageFn.init(); jQuery(window).load(function() { jQuery('.article-block').delay(300).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(jQuery) { $.fn.scrollClass = function(config) { var defaults = {}; var config = jQuery.extend(defaults, config); var target = this; function addAction() { var length = target.length; for (var i = 0; i < length; i++) { if (target.eq(i).hasClass('articleShow')) continue; var in_position = target.eq(i).offset().top + 100; var window_bottom_position = jQuery(window).scrollTop() + jQuery(window).height(); if (in_position < window_bottom_position) { target.eq(i).addClass('articleShow'); } } } addAction(); jQuery(window).on('scroll', function() { addAction(); }); return target; }; })(jQuery); 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 }); }; };