var isMobile = false,//区分移动端与PC端 mobile = false,//区分手机端与平板 w_width = 0, w_height = 0; function pageBox() { w_width = $(window).width(); w_height = $(window).height(); if (w_width <= 1024) { isMobile = true; $('html').addClass("Mobiletrue"); $('html').removeClass("Mobilefalse"); } else if (w_width > 1024) { isMobile = false; $('html').addClass("Mobilefalse"); $('html').removeClass("Mobiletrue"); } if (w_width <= 640) { mobile = true; } else if (w_width > 640) { mobile = false; } } pageBox(); $(document).ready(function() { var d_height = $(document).height(); var d_width = $(document).width(); var bg_open = false; if(mod == 'index'){ $('#fullpage').fullpage({ sectionsColor:['#ffffff','#1c3d7b','#1c3d7b','#1c3d7b','#1c3d7b','#1c3d7b','#1c3d7b'], //控制每个section的背景颜色 verticalCentered: false, //内容是否垂直居中(默认为true) css3: true, //是否使用 CSS3 transforms 滚动 anchors:['banner','about','product','process','news','contact','copyright'], //定义锚链接(值不能和页面中任意的id或name相同,尤其是在ie下,定义时不需要加#) scrollingSpeed: 500, navigation:true, navigationPosition: 'left', navigationTooltips: ['主页','关于','产品','生产','新闻','联系','版权'], showActiveTooltip:false, //menu:'#fullpage_menu', slidesNavigation:true, loopHorizontal: false, loopBottom: false, afterLoad: function(anchorLink, index){ function nav_show(){ $('.top_bg').addClass('hide'); $('.top_bg').removeClass("show"); } function nav_hide(){ $('.top_bg').removeClass("hide"); } if(mobile){ /*if(anchorLink!='banner'){ $('.top_bg').addClass('bgfff'); }else{ $('.top_bg').removeClass('bgfff'); }*/ }else{ if(anchorLink=='copyright'){ //$('.fullpage_menu').addClass('style01'); //$('.top_bg').addClass('bgfff'); //$('body').addClass('style01'); }else{ //$('.fullpage_menu').removeClass('style01'); //$('.top_bg').removeClass('bgfff'); //$('body').removeClass('style01'); } } if(!mobile){ if(index == 1){ //alert('第一个'); //$('.header').removeClass('fold-menu'); //nav_hide(); $('body').removeClass('top_bg_trans'); }else{ //alert('其它'); //nav_show(); $('body').addClass('top_bg_trans'); /*$('.header').addClass('fold-menu').find('.subnav').slideUp(300,function(e){ if($(this).css('display') == 'none'){ $('.menu_icon').removeClass('closed'); }else{ $('.menu_icon').addClass('closed'); } });*/ if(anchorLink=='network'){ $('.china_map').addClass('show'); }else{ $('.china_map').removeClass('show'); } } } //alert('第'+index+'个'); //$(".active .go-down").animate({opacity:'1'},500,'easeInOutCubic'); $('.active [data-animation]').each(function() { var element = $(this); element.addClass('animated'); element.appear(function() { var duration = ( element.data('duration') ? element.data('duration') : 1 ); if( duration > 1 ) element.css('animation-duration', duration + 'ms'); var delay = ( element.data('delay') ? element.data('delay') : 1 ); if( delay > 1 ) element.css('animation-delay', delay + 'ms'); element.addClass( element.data('animation') ); setTimeout(function() { element.addClass('visible'); }, delay); }); }); }, onLeave: function(index, direction){ //$(".active .go-down").animate({opacity:'1'},500,'easeInOutCubic'); /*$('[data-animation]').each(function() { var element = $(this); element.addClass('animated'); });*/ }, }); } //所有进入特效 $('[data-animation]').each(function() { var element = $(this); element.addClass('animated'); element.appear(function() { var duration = ( element.data('duration') ? element.data('duration') : 1 ); if( duration > 1 ) element.css('animation-duration', duration + 'ms'); var delay = ( element.data('delay') ? element.data('delay') : 1 ); if( delay > 1 ) element.css('animation-delay', delay + 'ms'); element.addClass( element.data('animation') ); setTimeout(function() { element.addClass('visible'); }, delay); }); }); //弹出框 $('.popup-video').magnificPopup({ type: 'ajax', //enableEscapeKey: true, //closeOnBgClick:false }); /*$('.menu_pop').click(function(){ if(mobile){ $('.navmenu').slideToggle(300); }else{ $('.index .top_bg').toggleClass('fold'); } });*/ //数字 $(".about_point .num,.honorbox .tabs .num").appear(function(){ /*$(this).each(function(){ datacount = $(this).attr('data-count'); $(this).find('.counter').delay(1000).countTo({ from: 0, to: datacount, speed: 3000, refreshInterval: 10, }); });*/ $(this).each(function(){ $(this).find('.counter').delay(1000).countUp(); }) }); $(window).resize(function(){ pageBox(); }); });