var Lplug={ //init Init:function(e){ var that=this; that.Index(); // that.stringSplit(); that.scrollVisual(); that.imgLazy(); that.Tab(); // that.scrollView(); // if($('.rellax').length>0){ // new Rellax('.rellax'); // } if(!that.isLetIe9()){ smoothScroll.init({offset:95}); if(that.winInfo()._winW>1200){ var wow = new WOW({ boxClass: 'wow', offset: 150, mobile: true, live: true }); wow.init(); var version = getChromeVersion(); if(version>70){ that.cursorFollow(); } } }else{ // that.setIe9(); if(that.isLetIe8()){//ie8 // alert("ie8"); } } that.closeLayer(); $(".lhShare").each(function(){ $(this).click(function(){ that.lhShare($(this).data()); }); }); }, //棣栭〉js Index:function(e){ var that=this; if($(".index_page").length){ //鍔犺浇瀹屾瘯 var topVal1=$.cookie('firstload'); if(topVal1){ $(".preload").remove(); $(".pace").remove(); bannerindex(); }else{ var indexload = false; setTimeout(function(){ if(topVal1==undefined){ $.cookie('firstload','999'); } if(!indexload){ indexload = true; console.log("indexload",indexload); $(".preload").remove(); $(".pace").remove(); // $(".index_page").addClass("pace-done"); bannerindex(); $(".banner .swiper-slide").eq(0).addClass("once"); $(".banner .swiper-slide").eq(0).removeClass("slick-active"); } },5000); Pace.on("done",function(){ console.log("椤甸潰鍔犺浇瀹屾瘯"); if(!indexload){ indexload = true; console.log("indexload",indexload); $(".preload").remove(); $(".pace").remove(); // $(".index_page").addClass("pace-done"); bannerindex(); $(".banner .swiper-slide").eq(0).addClass("once"); $(".banner .swiper-slide").eq(0).removeClass("slick-active"); } // if(topVal1==undefined){ // $.cookie('firstload','999'); // } // bannerindex(); // // console.log('鍒濆鍖?); // $(".banner .swiper-slide").eq(0).addClass("once"); // $(".banner .swiper-slide").eq(0).removeClass("slick-active"); }) } } var footheight = $(".footer").height(); $("body").css({"padding-bottom":footheight+"px"}); $(window).resize(function(){ var footheight = $(".footer").height(); $("body").css({"padding-bottom":footheight+"px"}); }) function bannerindex(){ if($(".swiper-container-banner").length>0){ var bannernum = $(".swiper-container-banner .swiper-slide").length; var swiperBanner = new Swiper('.swiper-container-banner', { loop:true, autoplay : 6000, autoplayDisableOnInteraction:true, stopOnLastSlide: true, direction : 'vertical', effect:"fade", pagination : '.swiper-pagination', paginationClickable: true, prevButton:'.swiper-container-banner .swiper-button-prev', nextButton:'.swiper-container-banner .swiper-button-next', onSlideChangeEnd: function(swiper){ console.log('鏀瑰彉浜嗭紝activeIndex涓?+swiper.activeIndex); $(".banner .swiper-slide").eq(bannernum+1).addClass("once"); $(".banner .swiper-slide").eq(swiper.activeIndex).addClass("once"); // $(".banner_nav .item").eq((swiper.activeIndex-1)%(bannernum)).addClass("on").siblings().removeClass("on"); } } ); $(".banner .pagination_wrap .main_visual_autoplay").click(function(){ if($(this).hasClass("pause")){ $(this).removeClass("pause"); swiperBanner.startAutoplay(); }else{ $(this).addClass("pause"); swiperBanner.stopAutoplay(); } }); $(".banner_nav .item").mouseover(function(){ $(this).addClass("on").siblings().css({"width":"12.5%"}) $(this).siblings().removeClass("on"); // swiperBanner.slideTo($(this).index()+1); // swiperBanner.stopAutoplay(); }); $(".banner_nav .item").mouseleave(function(){ // swiperBanner.startAutoplay(); }); } } if($(".index_news .imgnews").length>0){ var swiperimgnews = new Swiper('.index_news .imgnews', { slidesPerView: 1, prevButton:'.index_news .imgnews .swiper-button-prev', nextButton:'.index_news .imgnews .swiper-button-next', pagination : '.swiper-pagination', lazyLoading : true, loop:true, autoplay : 4500, autoplayDisableOnInteraction:true, stopOnLastSlide: true, // effect:"fade", pagination : '.swiper-pagination', paginationClickable: true, paginationType : 'fraction', // paginationType : 'progress', }); $(".index_news .imgnews").mouseover(function(){ swiperimgnews.stopAutoplay(); }); $(".index_news .imgnews").mouseleave(function(){ swiperimgnews.startAutoplay(); }); } //椤堕儴瀵艰埅js var curindex; $('.rightnav li').each(function(){ if($(this).hasClass("cur")){ curindex = $(this).index(); console.log(curindex); } }) var oldx,oldy; $('.rightnav li').mouseenter(function(event){ console.log(event); if($(this).hasClass("cur") && !$(".headtop").hasClass("leave") && !$(".headtop").hasClass("scroll")){ return false; } $(".headtop").addClass("headHover"); $(this).addClass('cur').siblings("li").removeClass("cur"); var nowtypeid = $(this).attr("data-typeid"); $('.subnavwarp').stop().slideUp(); if($('.subnavwarp .con[data-typeid="'+nowtypeid+'"]').hasClass("con")){ $('.subnavwarp').stop().slideDown(); $('.subnavwarp .con[data-typeid="'+nowtypeid+'"]').stop().fadeIn().siblings().hide(); } }); $('.rightnav .lh-search').mouseenter(function(event){ $(".headtop").addClass("headHover"); }); $('.headtop').mouseleave(function(){ $(".headtop").addClass("leave").removeClass("headHover"); $('.subnavwarp').slideUp(); $('.subnavwarp .con').fadeOut(300); $('.rightnav li').eq(curindex).addClass("cur").siblings("li").removeClass("cur"); }); $(".head .rightnav>ul>li a,.subnavwarp .con ul.subnav li a").click(function(){ $('.subnavwarp').slideUp(); $('.subnavwarp .con').fadeOut(300); }); $(".banner,.subbanner").mouseleave(function(){ $(".headtop").addClass("leave"); }) $(".lh-search a").click(function(){ if($(".headtop").hasClass("Search")){ if($(".lh-search input[name='keyword']").val()==''){ $(".headtop").removeClass("Search"); }else{ $(".lh-search").submit(); } }else{ $(".headtop").addClass("Search"); } }); $(".z_search a").click(function(){ if($(".z_search input[name='keyword']").val()!=''){ $(".z_search_form").submit(); } }); $(".menunav").click(function(){ if($(".z_menu_mask").hasClass("on")){ $(".z_menu_mask").removeClass("on"); }else{ $(".z_menu_mask").addClass("on"); } }); $(".z_menu_close").click(function(){ $(".z_menu_mask").removeClass("on"); }); $(".video .video_play").click(function(){ // $(".video .video_play").hide(); // $(".video").css({"background":"none"}); $(".video_bg").fadeIn(); $(".video_inner").fadeIn(); var video = document.getElementById("index_video"); video.play(); }); // $(".about_video .video_play").click(function(){ // $(".about_video .video_play").hide(); // $(".about_video img").hide(); // var video = document.getElementById("index_video"); // video.play(); // }); $(".about_video_wrap").click(function(){ $(".about_video .video_play").hide(); $(".about_video img").hide(); var video = document.getElementById("index_video"); video.play(); }); $(".video_inner span").click(function(){ var video = document.getElementById("index_video"); video.pause(); $(".video_bg").fadeOut(); $(".video_inner").fadeOut(); }); //瀵艰埅婊氬姩 var s = $(document).scrollTop(); scrollClass(s); $(window).scroll(function(){ var s = $(document).scrollTop(); scrollClass(s); }); function scrollClass(s){ var c=0; if($('.subbanner').length>0){ // c=$('.subbanner').height()-100; c=100; if($(".subpagenav").hasClass("nofixed")){ }else{ if($('.subpagenav').length>0){ if(s>$('.subbanner').height()-100){ $('.subpagenav').addClass("fixed"); }else{ $('.subpagenav').removeClass("fixed"); } if($(".subpagenav").hasClass("louceng")){ for (i=1; i<$('.subpagenav .container a').length+1; i++){ //鍔犲惊鐜 if($("#subpagenav"+i).offset().top<=s+340){ //鍒ゆ柇婊氬姩鏉′綅缃 $('.subpagenav a').removeClass("on"); //娓呴櫎c绫 $(".subpagenav a").eq(i-1).addClass("on"); //缁欏綋鍓嶅鑸姞c绫 } } } // 鍔ㄧ敾鏄剧ず if($('.subpagenav').hasClass("fixed") && window.location.hash!=''){ $(".subpagenav").css({"visibility":"visible"}); } } } }else{ // c=$('.banner').height()-300; c=100; } if(s>=c){ $('.headtop').addClass('scroll'); }else{ $('.headtop').removeClass('scroll'); } } if($(".swiper-container-fazhan").length>0){ var swiperfazhan = new Swiper('.swiper-container-fazhan', { slidesPerView: 4, prevButton:'.history .swiper-button-prev', nextButton:'.history .swiper-button-next', }); // $('.swiper-container-fazhan .swiper-wrapper').slick({ // autoplay: false, //鏄惁鑷姩鎾斁 // pauseOnHover: false, //榧犳爣鎮仠鏆傚仠鑷姩鎾斁 // speed: 500, //鍒囨崲鍔ㄧ敾閫熷害 // autoplaySpeed: 5000, //鑷姩鎾斁閫熷害 // swipeToSlide: true, //鍏佽鐢ㄦ埛鐩存帴鎷栧姩鎴栨粦鍔ㄥ埌骞荤伅鐗囦笂 // slidesToShow:4, // slidesToScroll:1, // touchThreshold: 20, //鏇存崲骞荤伅鐗囬渶婊戝姩瀹藉害锛? / touchThreshold锛 // arrows: true, //鏄惁寮€鍚乏鍙冲垏鎹 // draggable: true, //鏄惁鍚敤榧犳爣鎷栧姩 // rows: 1, //鏄剧ず鍑犺锛岄粯璁や负 1 // fade:false, // 寮€鍚笎闅愬垏鎹㈡ā寮 // dots:false, // }); } if($(".party_wrap .imgs_container").length>0){ var swiperparty = new Swiper('.party_wrap .imgs_container', { slidesPerView: 1, prevButton:'.party_wrap .swiper-button-prev', nextButton:'.party_wrap .swiper-button-next', lazyLoading : true, loop:true, autoplay : 4500, autoplayDisableOnInteraction:true, stopOnLastSlide: true, // effect:"fade", pagination : '.swiper-pagination', paginationClickable: true, paginationType : 'fraction', }); $(".party_wrap .imgs_container").mouseover(function(){ swiperparty.stopAutoplay(); }); $(".party_wrap .imgs_container").mouseleave(function(){ swiperparty.startAutoplay(); }); } if($(".product_subnav").length>0){ var swiperpronav = new Swiper('.product_subnav', { slidesPerView: 4, prevButton:'.product_subnav .swiper-button-prev', nextButton:'.product_subnav .swiper-button-next', }); } // if($(".product_con_imgs").length>0){ // var product_con_imgs = $(".product_con_imgs .con").length; // var swiperfazhan = new Swiper('.product_con_imgs', { // slidesPerView: 1, // centeredSlides : true, // spaceBetween : 80, // loop:true, // speed:400, // pagination : '.swiper-pagination', // // paginationType : 'fraction', // paginationType : 'progress', // prevButton:'.product_con_imgs .swiper-button-prev', // nextButton:'.product_con_imgs .swiper-button-next', // onSlideChangeStart: function(swiper){ // console.log('鏀瑰彉浜嗭紝activeIndex涓?+swiper.activeIndex); // var activeIndex=swiper.activeIndex>product_con_imgs?swiper.activeIndex%product_con_imgs:swiper.activeIndex; // $(".product_con_imgs .swiper-number .curindex").text(activeIndex); // } // }); // } if($(".subpagenav").length>0){ $(".subpagenav a").click(function(){ $(this).addClass("on").siblings().removeClass("on"); }) } if($(".joblist").length){ $(".joblist ul li .dt").click(function(){ if($(this).find(".zkbtn").hasClass("open")){ $(this).find(".zkbtn").removeClass("open") }else{ $(this).find(".zkbtn").addClass("open") } $(this).next(".cont").slideToggle(); $(this).parent("li").siblings("li").find(".cont").slideUp(); }) $(".yingpin a").click(function(e){ e.stopPropagation(); }); } }, //娴忚鍣ㄧ獥鍙e搴 winInfo:function(){ var width = $(window).width(); var height = $(window).height(); return {_winW:width,_winH:height}; }, //ie9娴忚鍣 isLetIe9:function(){ return navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<=9; }, //ie8娴忚鍣 isLetIe8:function(){ return navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<=8; }, setIe9:function(){ var that=this; that.LetIe9Items(); }, //ie8娴忚鍣ㄨ皟鐢ㄧ殑js setIe8:function(){ var that=this; $('.ie8Fullscreen').height(this.winInfo()._winH); that.LetIe9Items(); }, //鍥剧墖婊氬姩鏁堟灉 imgScroll:function(a){ var a=a||{},opt=$.extend({ boxCell:'.banner' },a); $(window).scroll(function(){ var s= $(this).scrollTop()/3; $(opt.boxCell).find('.bgb').css({ 'background-position':'center '+s+'px' }); }); }, //婊氬姩瑙嗚宸 scrollVisual:function(e){ var that=this,winH=that.winInfo()._winH,winW=that.winInfo()._winW,e=e||window; $(e).scroll(function(){ scrollAn(); }); scrollAn(); function scrollAn(){ $('[data-visual]').each(function(){ //speed 閫熷害(0.1);type 鑳屾櫙鍥剧墖杩樻槸鏅€氬厓绱?榛樿鏅€氬厓绱?;direction 鏂瑰悜(y);x--妯悜锛寉--绔栧悜 var _scrollTop=$(e).scrollTop(),_offsetTop=$(this).offset().top,speed=$(this).data('visual-speed')||0.1,type=$(this).data('visual-type')||'',direction=$(this).data('visual-direction')||'y',cl=$(this).data('visual-class')||''; if(_offsetTop<_scrollTop+winH-250 &&_offsetTop+winH>_scrollTop){ var position=speed*_scrollTop; if(cl){ if(direction=='y'){//绔栧悜 if(!type){//鏅€氬厓绱 $(this).css({'transform':'translateY('+position+'px)','transition':'0s'}); }else{//鑳屾櫙鍥剧墖 $(this).css({'background-position':'center '+position+'px'}); } }else{//妯悜 if(direction=='-x'){ if(!type){//鏅€氬厓绱 $(this).css({'transform':'translateX(-'+position+'px)','transition':'0s'}); }else{//鑳屾櫙鍥剧墖 $(this).css({'background-position':'-'+position+'px center'}); } }else{ if(!type){//鏅€氬厓绱 $(this).css({'transform':'translateX('+position+'px)','transition':'0s'}); }else{//鑳屾櫙鍥剧墖 $(this).css({'background-position':''+position+'px center'}); } } } if(cl=='servicesR'){ $(this).css({'transform':'rotate(180deg) translateY('+position+'px)','transition':'0s'}); } } if($(this).find('.tlt').length>0){ $('.tlt').textillate(); } $(this).addClass('Visual'); }else{ //$(this).removeClass('Visual'); } }); } }, //婊氬姩 scrollView:function(e){ var that=this,winH=that.winInfo()._winH,winW=that.winInfo()._winW, ticking = false,e=e||window,p=0,t=0,letter=0,translateX=120; // rAF 瑙﹀彂閿 scrollViewFun(ticking); function onScroll(){ if(!ticking) { requestAnimationFrame(realFunc); ticking = true; } } function realFunc(){ ticking = false; scrollViewFun(); } $(e).scroll(function(){ onScroll(); }); function scrollViewFun(ticking){ p=$(e).scrollTop(); $('[data-scrollView]').each(function(){ var _scrollTop=$(e).scrollTop(),_offsetTop=$(this).offset().top,speed=$(this).attr('data-visual-speed')||0.1,_type=$(this).data('type'),style=$(this).attr('style'); if(_offsetTop<_scrollTop+winH &&_offsetTop+winH>_scrollTop){ var position=speed*_scrollTop; if(_type=='scaleMax'){//鏀惧ぇ var position=position/1000; if(ticking==false){ $(this).css({transform:'scale(1)',transition:'cubic-bezier(0.215,.61,.355,1) 2s'});$(this).removeAttr('data-scrollview'); return; } if(position<=0.7){ position=0.7; } if(position>=1){ //$(this).removeAttr('data-scrollview'); position=1; } $(this).css({transform:'scale('+position+')',transition:'ease 0s'}); } if(_type=='scaleMin'){//缂╁皬 var scaleMinposition=speed-_scrollTop/8000; console.log(scaleMinposition); if(ticking==false){ $(this).css({transform:'scale(1)',transition:'cubic-bezier(0.215,.61,.355,1) 2s'});$(this).removeAttr('data-scrollview'); return; } if(scaleMinposition<=1){ $(this).removeAttr('data-scrollview'); } $(this).css({transform:'scale('+scaleMinposition+')',transition:'ease 0s'}); } if(_type=='powers'){//鏁板瓧婊氬姩 that.digitalIncreasing(); } if(_type=='translateX'){ if(ticking==false){ $(this).css({transform:'translateX(0px)',transition:'cubic-bezier(0.215,.61,.355,1) 1s'});$(this).removeAttr('data-scrollview'); return false; } if(p>=t){ translateX-=0.5; }else{ translateX+=0.5; } if(translateX<=0){ $(this).removeAttr('data-scrollview'); } console.log(translateX); $(this).css({transform:'translateX('+translateX+'px)',transition:'ease 0s'}); } if(_type=='letter'){ $(this).css({'transform':'translateY(-'+position+'px) rotate(-90deg)',transition:'ease 0s'}); } } }); t=p; } }, Tab:function(e){ $('.lhTab').each(function(){ var index = $(this).data('index')||0,effect=$(this).data('effect')||''; $(this).children('.hd').children('li').eq(index).addClass('on'); $(this).children('.bd').children().eq(index).show(); if(1){ $(this).children('.hd').children('li').hover(function(){ var _this=$(this),_index=_this.index(); if(!_this.hasClass('on')){ _this.addClass('on').siblings().removeClass('on'); _this.parent().next('.bd').children().fadeOut(0); _this.parent().next('.bd').children().eq(_index).fadeIn(500); _this.parents('.container').children('.cd').children().fadeOut(0); _this.parents('.container').children('.cd').children().eq(_index).fadeIn(500); _this.parent().next('.bd').children().eq(_index).find("img.lazy").each(function(){ $(this).attr("src",$(this).attr("data-original")); }); _this.parent().next('.cd').children().eq(_index).find("img.lazy").each(function(){ $(this).attr("src",$(this).attr("data-original")); }); } }); }else{ $(this).children('.hd').children('li').click(function(){ var _this=$(this),_index=_this.index(); if(!_this.hasClass('on')){ _this.addClass('on').siblings().removeClass('on'); _this.parent().next('.bd').children().fadeOut(0); _this.parent().next('.bd').children().eq(_index).fadeIn(500); _this.parents('.container').children('.cd').children().fadeOut(0); _this.parents('.container').children('.cd').children().eq(_index).fadeIn(500); _this.parent().next('.bd').children().eq(_index).find("img.lazy").each(function(){ $(this).attr("src",$(this).attr("data-original")); }); _this.parent().next('.cd').children().eq(_index).find("img.lazy").each(function(){ $(this).attr("src",$(this).attr("data-original")); }); } }); } }); }, layerDate:function(e){ var e=e||{}; var opt = $.extend({ name:'.times', date:'date', min:'' },e); laydate.render({ elem: opt.name, date:opt.date, min:opt.min }); }, //寮圭獥 Layer:function(e){ var name=$(e).data('name'); $('body').addClass(name); if(!$(e).data('shadow')){ var shadow ='
'; $('body').append(shadow); $('body').bind('mousewheel', function(event, delta) {return false;}); } }, closeLayer:function(e){ $(document).on('click','.closes,.shadows',function(){ var name = $(this).attr('data-name'); $('body').removeClass(name); $('.shadows.'+name).remove(); $('body').unbind('mousewheel'); }); //鍏抽棴鍥剧墖寮圭獥 $(document).on('click','.lh-imgLayer-close',function(){ $('.lh-imgLayer-banner').css({'animation':'imgLayer1 cubic-bezier(0.215,.61,.355,1) .65s forwards'}); $('body').removeClass('overflow'); setTimeout(function(){ $('.lh-imgLayer-banner').remove(); },650); $('body').unbind('mousewheel'); return false; }); }, imgLayer:function(e){ var that=this, index = $(e).data('index')||0; var liLength = $(e).parents('ul').children().length,li=''; var img; if(liLength>1){//澶氫釜 $($(e).parents('ul').children()).each(function(){ img = $(this).find('.imgBtn').data('bigimg'); li+='
  • '; }); }else{//鍗曚釜 img = $(e).data('bigimg'); //li+='
  • '; if(img.substr(0,1)==','){ var imgArr = img.split(','); var newArr = imgArr.slice(1); for(var i=0;i'; } }else{ li+='
  • '; } } var html='
    '; $('body').append(html).addClass('overflow'); $('body').bind('mousewheel', function(event, delta) {return false;}); if($(window).width()<=980){ $('.lh-imgLayer-banner li>div').each(function () { new RTP.PinchZoom($(this), {}); }); } if(liLength>1||img.substr(0,1)==','){ var swiper = that.setBanner({boxCell:'.lh-imgLayer-banner',effect:'slide',prevEl:'.prevn',nextEl:'.nextn'}); swiper.slideTo(index, 0, false); }else{ $('.prevn,.nextn').hide(); } }, //绔嬪嵆鍜ㄨ consult:function(e){ $(document).on('click','.lhLjzx',function(){ var url = $(this).data('url'); window.open(url); return false; }); }, //瀛楃涓叉崲琛 stringSplit:function(e){ $('.lhSplit').each(function(){ var text = $(this).text().split(' '); if(text.length==2){ $(this).html(text[0]+'
    '+text[1]); } if(text.length==4){ $(this).html(text[0]+' '+text[1]+'
    '+text[3]+''+text[4]); } }); }, //鏁板瓧閫掑 digitalIncreasing:function(e){ if($('.power').length>0){ $('.power').each(function(j,e){ var _this=$(this), to = Number($(this).data('to'))||Number($(this).text()),from = Number($(this).data('from'))||0,speed = $(this).data('speed')||1500; var refreshInterval=100; var loops = Math.ceil(speed / refreshInterval), increment = Math.ceil((to - from) / loops); var n,num=0; n = setInterval(function(){ num+=increment; _this.text(num); if(num>=to){ _this.text(to); clearInterval(n); } _this.removeClass('power') },refreshInterval); }); } }, //鍒嗕韩 lhShare:function(e){ if(e.type=='xinlang'){ window.open('http://v.t.sina.com.cn/share/share.php?title=&url='+encodeURIComponent(location.href)+'&appkey=&language=zh_cn&source=&sourceUrl=&ralateUid=&message=&uids=&pic=&searchPic=false&content=','_blank','width=450,height=400'); } if(e.type=='weixin'){ if($('#lhCode').length>0){ return false; } var html = '

    鍒嗕韩鍒 - 寰俊

    '; $('body').append(html); $('#lhCode>.ewm').qrcode(location.href); $('#lhCode>h2>i').click(function(){ $('#lhCode').remove(); }); } if(e.type=='kongjian'){ window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(location.href)+'&pics=&summary='+encodeURIComponent(document.title),'_blank','width=450,height=400'); } if(e.type=='qqhy'){ window.open('https://connect.qq.com/widget/shareqq/index.html?url='+encodeURIComponent(location.href)+'&desc='+encodeURIComponent(document.title)+'&pics=&site=','_blank','width=816,height=666,left=40,top=80'); } }, //杩斿洖椤堕儴 returnTop:function(e){ $(document).on('click','.lhReturnTop',function(){ $('body,html').animate({scrollTop:'0px'}); }); }, //榧犳爣璺熼殢 cursorFollow: function(e) { if($(window).width() > 1024) { $(document).on('mousemove', function(e) { $('.cursor').css({ // visibility: 'visible' visibility: 'hidden' }); var clientX = e.clientX, clientY = e.clientY; var scrollLeft = $(this).scrollLeft(), scrollTop = $(this).scrollTop(); var left = clientX + scrollLeft, top = clientY + scrollTop; /*myTween = TweenLite.to($('.cursor'), 0, { x: left, y: top });*/ }) // mouseClass($('.rightnav li a'), 'nav'); mouseClass($('.a'), 'btn'); mouseClass($('a'), 'btn2'); function mouseClass(a, b) { a.mouseenter(function() { $('.cursor').addClass(b); }).mouseleave(function() { $('.cursor').removeClass(b); }); } } }, isPointInCircle:function(a){ var radius = a.boxCell.innerWidth()/2; var centerX= a.boxCell.offset().left+radius; var centerY = a.boxCell.offset().top+radius; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var e = window.event; var x = e.pageX || e.clientX + scrollX; var y = e.pageY || e.clientY + scrollY; var diffX = centerX - x,diffY = centerY - y; var inCircle = radius * radius >= diffX * diffX + diffY * diffY; if(inCircle){ if(a.boxCell[0].className=='lh-round-share'){ $('.lh-cursor').addClass('share'); } }else{ if(a.boxCell[0].className=='lh-round-share'){ $('.lh-cursor').removeClass('share'); } } }, /* *display:flex;align-items: center;瑙e喅鏂规 start==== *@param boxCell //澶栧眰鐩掑瓙class *@param upDown //鏄惁涓婁笅灞呬腑 *@param leftRight //鏄惁宸﹀彸灞呬腑 */ //鑾峰彇鍐呭灞傜洅瀛愰珮搴 LetIe9Items:function(a){ var that=this, a=a||{}; var opt = $.extend({ boxCell:'.letIe9Height', upDown:true,//涓婁笅灞呬腑 leftRight:false,//宸﹀彸灞呬腑 },a); $(opt.boxCell).each(function(){ var self = $(this); var boxCellHeight = that.LetIe9Height(self.parent()),innerCellHeight=that.LetIe9Height(self),paddingTop=(boxCellHeight-innerCellHeight)/2; var boxCellWidth = that.LetIe9Width(self),innerCellWidth=that.LetIe9Width(self.children()),paddingLeft=(boxCellWidth-innerCellWidth)/2; if(opt.upDown&&opt.leftRight){ self.css({'padding-top':paddingTop,'padding-left':paddingLeft}); } if(!opt.upDown&&opt.leftRight){ self.css({'padding-left':paddingLeft}); } if(opt.upDown&&!opt.leftRight){ self.css({'padding-top':paddingTop}); } }); }, //楂樺害璁$畻 LetIe9Height:function(a){ return a.height(); }, //瀹藉害璁$畻 LetIe9Width:function(a){ return a.width(); }, /* *display:flex;align-items: center;瑙e喅鏂规 end==== */ SetIe8Transform:function(a){ var that=this, a=a||{}; var opt = $.extend({ boxCell:'.ie8Transform', },a); $(opt.boxCell).each(function(){ var self = $(this); var boxCellHeight = that.LetIe9Height(self.parent()),innerCellHeight=that.LetIe9Height(self),top=(boxCellHeight-innerCellHeight)/2; var boxCellWidth = that.LetIe9Width(self.parent()),innerCellWidth=that.LetIe9Width(self),left=(boxCellWidth-innerCellWidth)/2; self.css({left:left,top:top}); }); }, /* *position: absolute;transform: translate(-50%,-50%);灞呬腑ie8瑙e喅鏂规 end==== */ /*let ie9 end*/ imgLazy: function(){ $("img.lazy").lazyload({ threshold : 150 }); } } Lplug.Init();