var lplug={ //浏览器窗口宽度 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; }, //ie8浏览器调用的js setie8:function(){ $('.lh-banner').height(this.wininfo()._winh); }, setbanner:function(a){ var a=a||{}; var opt = $.extend({ boxcell:'.lh-banner', paginationel:'.lh-banner-hd', paginationtype:'bullets', paginationbulletelement:'li', paginationdynamicbullets:false, paginationdynamicmainbullets:1, paginationclickable:true, paginationrenderbullet:null, paginationbulletactiveclass:'on', stoponlastslide:true, slidesperview:1, spacebetween:0, speed:1000, loop:false, direction:'horizontal', initialslide:0, effect:'fade', mousewheel:false, nextel:'.next', prevel:'.prev', noswipingclass:'stop-swiping', on:null, observer:true, observeparents:true, parallax:true, disableoninteraction:false, maincell:'.swiper-wrapper', autopage:true, autoplay:false, delay:4500, stoponlastslide:false, disableoninteraction:true, hashnavigation:false },a); if($(opt.boxcell).find('.next').length>0){ var nextel = $(opt.boxcell).find('.next'),prevel = $(opt.boxcell).find('.prev'); }else{ var nextel =opt.nextel,prevel =opt.prevel; } if(opt.autoplay){ var autoplay ={ delay:opt.delay, stoponlastslide:opt.stoponlastslide, disableoninteraction:opt.disableoninteraction } }else{ var autoplay=false; } if(this.wininfo()._winw<=980){ opt.effect='slide'; } var useragent = navigator.useragent; if(useragent.indexof('chrome')<=-1 && opt.effect !='fade'){ opt.effect='slide'; } var myswiper = new swiper(opt.boxcell,{ parallax : opt.parallax, slidesperview:opt.slidesperview, initialslide :opt.initialslide, pagination : { el : opt.paginationel, type:opt.paginationtype, bulletelement:opt.paginationbulletelement, dynamicbullets:opt.paginationdynamicbullets, dynamicmainbullets:opt.paginationdynamicmainbullets, clickable:opt.paginationclickable, renderbullet:opt.paginationrenderbullet, bulletactiveclass:opt.paginationbulletactiveclass }, speed:opt.speed, loop:opt.loop, effect : opt.effect, spacebetween:opt.spacebetween, navigation: { nextel: nextel, prevel: prevel, }, direction:opt.direction, mousewheel:opt.mousewheel, noswipingclass:opt.noswipingclass, on:opt.on, observeparents:opt.observeparents, observer:opt.observer, autoplay:autoplay, stoponlastslide:opt.stoponlastslide, disableoninteraction:opt.disableoninteraction, hashnavigation:opt.hashnavigation }); if(autoplay){ $(opt.boxcell).mouseenter(function () { myswiper.autoplay.stop(); }) $(opt.boxcell).mouseleave(function () { myswiper.autoplay.start(); }) } return myswiper; }, //init init:function(e){ var that=this; that.index(); that.case(); that.returntop(); that.detail(); new wow().init(); if($('.timer').length>0){ var a = math.round($('.lh-power').offset().top+100); var b = math.round($(window).scrolltop()+$(window).height()); if(a0){ var text = $('.ljmenu1 pre').text().split(' '); var text = skipemptyelementforarray(text); $('.ljmenu1 pre').html(text[0]+'
'+text[1]) function skipemptyelementforarray(arr){ var a = []; $.each(arr,function(i,v){ var data = $.trim(v);//$.trim()函数来自jquery if('' != data){ a.push(data); } }); return a; } } } }, fixednav:function(){ if(this.wininfo()._winw>980){ var p=0;t=0; $(window).scroll(function(){ p = $(this).scrolltop(); if(t<=p){ $('body').addclass('fixed'); }else{ $('body').removeclass('fixed'); } t=p; }); } }, //详情页 detail:function(e){ var that=this; if($('.lh-detail').length>0){ var imgsrc = $('.lh-detail-ban img').attr('src'),img = new image; img.src = imgsrc; img.onload = function(){ rgbaster.colors(img,{ success:function(payload){ $('body,.lh-footer').css({background:payload.dominant}); $('.lh-footer').addclass('detail'); } }); } $('.lh-detail-cont').find('img').addclass('wow fadein'); } }, //案例 case:function(e){ var that=this; var winh = that.wininfo()._winh; if($('.lh-case').length>0){ var doscroll = $(document).scrolltop(); $(document).scroll(function(){ var doscroll = $(this).scrolltop(); bananimate(doscroll,winh); }); bananimate(doscroll,winh); function bananimate(doscroll,winh){ $('body').removeclass('spread'); $('.lh-ban .text').css({'transform':'translatey('+-(doscroll)+'px)'}); if(doscroll>=winh/3 && doscroll<=winh*2){ $('body').addclass('spread'); } } function navscroll(doscroll,winh){ //导航滚动效果 if(doscroll>=(winh-114)){ $('body').addclass('nav'); }else{ $('body').removeclass('nav'); } } } if($('.lh-workspace-banner').length>0){ that.setbanner({boxcell:'.lh-workspace-banner',paginationel:'.lh-workspace-hd',autoplay:true}); } //project if($('.lh-project-item').length>0 && that.wininfo()._winw>980){ $('.lh-project-item li .img').hover(function(){ $(this).parents('li').next().addclass('hover'); },function(){ $('.lh-project-item li').removeclass('hover'); }); $('.lh-project-item li .text').hover(function(){ $(this).parents('li').prev().addclass('hover'); },function(){ $('.lh-project-item li').removeclass('hover'); }); $('.lh-project-item li').each(function(i,e){ if(parseint(i/5)%2==1){ $(this).addclass('liright'); } if((i+1)%10==6){ $(this).addclass('li6'); } if(i>10){ i=i-10*(i%10); } if(i==1||i==7){//向上 $(this).addclass('down'); }else{//向下 $(this).addclass('up'); } }); } }, //首页js index:function(e){ var that=this; that.indexpage();//滚动效果 //地址切换 if($('.lh-addr-tab').length>0){ $('.lh-addr-hd li').eq(0).addclass('on'); // var addrbanner = that.setbanner({boxcell:'.lh-addr-bd',effect:'slide'}); // $('.lh-addr-hd li').hover(function(){ // var _index = $(this).index(); // $(this).addclass('on').siblings().removeclass('on'); // addrbanner.slideto(_index,1000,false); // }); } }, //首页滚动效果 indexpage:function(e){ var that=this; //荣誉轮播 if($('.lh-plant3-banner').length>0){ var honorswiper = that.setbanner({boxcell:'.lh-plant3-banner',effect:'slide',paginationel:'.lh-plant3-hd',loop:true,on: { imagesready: function(){ if(that.wininfo()._winw<=980){ $('.lh-plant3-banner .bd li').each(function(){ $(this).find('img').width($(this).find('img').width()/2); }); } }, }, }); } if($('.lh-index-plant').length>0){ var noswipingclass ='lh-index-plant'; if(that.wininfo()._winw<=1024){ noswipingclass = 'stop-swiping'; } var plantswiper = that.setbanner({boxcell:'.lh-index-plant',effect:'slide',direction:'vertical',mousewheel:true,hashnavigation:true,speed:1000,noswipingclass:noswipingclass,on:{ slidechangetransitionstart:function(){ var activeindex = this.activeindex; $('body').removeclass('plant2 plant3 plant4 plant5 plant6 navblack'); honorswiper.autoplay.stop(); honorswiper.slideto(1,0,false); var _winh = lplug.wininfo()._winh; if(activeindex==0){ var s =_winh/2; $('.lh-index-kooant').css({transform:'translatey(30vh)'}); } if(activeindex==1){ $('body').addclass('plant2'); var height = $('.lh-plant2 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var s = _winh+height-thisheight/2; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); $(window).resize(function(){ var height = $('.lh-plant2 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var _winh = lplug.wininfo()._winh; var s = _winh+height-thisheight/2; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); }); $('.timer').countto(); } if(activeindex==2){ $('body').addclass('plant3'); var height = $('.lh-plant3 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var s = _winh*2+height+thisheight/2; if(lplug.wininfo()._winw<=980){ s = _winh*2+height-thisheight/2; } $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); $(window).resize(function(){ var height = $('.lh-plant3 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var _winh = lplug.wininfo()._winh; var s = _winh*2+height+thisheight/2; if(lplug.wininfo()._winw<=980){ s = _winh*2+height-thisheight/2; } $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); }) honorswiper.autoplay.start(); } if(activeindex==3){ $('body').addclass('plant4'); var height = $('.lh-plant4 .lh-plant2-text').position().top; var aheight = $('.lh-plant4 .lh-plant2-text>h2').outerheight()+$('.lh-plant4 .lh-plant2-text>h3').outerheight()+$('.lh-plant4 .lh-plant2-text>pre').outerheight()+30; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant4 .lh-plant2-text>h2').outerheight()+$('.lh-plant4 .lh-plant2-text>h3').outerheight()+$('.lh-plant4 .lh-plant2-text>pre').outerheight()+10; } var thisheight = $('.lh-index-kooant').height(); var s = _winh*3+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); $(window).resize(function(){ var height = $('.lh-plant4 .lh-plant2-text').position().top; var aheight = $('.lh-plant4 .lh-plant2-text>h2').outerheight()+$('.lh-plant4 .lh-plant2-text>h3').outerheight()+$('.lh-plant4 .lh-plant2-text>pre').outerheight()+30; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant4 .lh-plant2-text>h2').outerheight()+$('.lh-plant4 .lh-plant2-text>h3').outerheight()+$('.lh-plant4 .lh-plant2-text>pre').outerheight()+10; } var thisheight = $('.lh-index-kooant').height(); var _winh = lplug.wininfo()._winh; var s = _winh*3+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); }) } if(activeindex==4){ $('body').addclass('plant5'); var height = $('.lh-plant5 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var aheight =0; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant5 .title').outerheight(); } var s = _winh*4+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); $(window).resize(function(){ var height = $('.lh-plant5 .lh-plant2-text').position().top; var thisheight = $('.lh-index-kooant').height(); var aheight =0; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant5 .title').outerheight(); } var _winh = lplug.wininfo()._winh; var s = _winh*4+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); }) } if(activeindex==5){ var height = $('.lh-plant6 .lh-plant2-text').position().top/2; var thisheight = $('.lh-index-kooant').height(); var aheight =0; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant6 .title').outerheight()+10; height = $('.lh-plant6 .lh-plant2-text').position().top; } var s = _winh*5+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); $(window).resize(function(){ var height = $('.lh-plant6 .lh-plant2-text').position().top/2; var thisheight = $('.lh-index-kooant').height(); var aheight =0; if(lplug.wininfo()._winw<=980){ aheight = $('.lh-plant6 .title').outerheight()+10; height = $('.lh-plant6 .lh-plant2-text').position().top; } var _winh = lplug.wininfo()._winh; var s = _winh*5+height+aheight; $('.lh-index-kooant').css({transform:'translatey('+s+'px)'}); }) } if(activeindex==5 || activeindex==6){ $('body').addclass('plant6'); } if(activeindex==3 || activeindex==4 || activeindex==5 || activeindex==6){ $('body').addclass('navblack'); } } }}); $('.lh-plant-btn').click(function(){ plantswiper.slideto(1,1000,false); }); } }, //返回顶部 returntop:function(e){ $(document).on('click','.lhreturntop',function(){ $('body,html').animate({scrolltop:'0px'}); }); } } lplug.init();