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; $('.ny_banner').css({'margin-top':$('.mobileheader').height()+'px'}); } else if (w_width > 640) { mobile = false; } } pagebox(); $(function () { var d_height = $(document).height(); var d_width = $(document).width(); var bg_open = false; //首页滚动 $('#fullpage').fullpage({ sectionscolor:['#ffffff','#ffffff','#ffffff','#ffffff','#ffffff','#ffffff'], //控制每个section的背景颜色 verticalcentered: true, //内容是否垂直居中(默认为true) anchors:['page1','page2','page3','page4','page5','page6'], //定义锚链接(值不能和页面中任意的id或name相同,尤其是在ie下,定义时不需要加#) navigation:true, navigationposition: 'left', menu:false, slidesnavigation:true, afterload: function(anchorlink, index){ /*if(index == 1){ alert('第一个'); }else{ alert('其它'); }*/ //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'); }); }, }); //数字 $(".count-number").appear(function(){ $(this).each(function(){ datacount = $(this).attr('data-count'); $(this).delay(6000).countto({ from: 0, to: datacount, speed: 3000, refreshinterval: 10, }); }); }); //点击菜单导航显示 /*$('.showmenu').on('click', function() { $('.navbox1').toggleclass('expanded'); $('.showmenu').toggleclass('close'); $('.navmenu1 #menu').toggleclass('expanded'); $('.navmenu1_bg').toggleclass('open'); });*/ $('.navicon').on('click', function() { $('.navmenu').toggleclass('expanded'); }); //所有进入特效 $('[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); }); }); //footer $(window).scroll(function () { if ($(document).scrolltop() + $(window).height() >= $(document).height() - 150) { if(!ismobile){ /*$('#footer').css("display",'block'); $('#footer').delay(200).animate({bottom:0,opacity:1},800,'easeinoutcubic');*/ } } }); //跟随导航 $(window).scroll(function () { if ($(document).scrolltop() > 400) { $('.am-sticky-placeholder').css("display",'block'); }else if($(document).scrolltop() < 900) { $('.am-sticky-placeholder').css("display",'none'); } }); //console.log(tpwidth); $(window).resize(function(){ pagebox(); //$('.product_banner').height(w_height); //$('.product_list').height(w_height); }); //自定义tap $(document).on("touchstart", function (e) { if (!$(e.target).hasclass("disable")) $(e.target).data("ismoved", 0); }); $(document).on("touchmove", function (e) { if (!$(e.target).hasclass("disable")) $(e.target).data("ismoved", 1); }); $(document).on("touchend", function (e) { if (!$(e.target).hasclass("disable") && $(e.target).data("ismoved") == 0) $(e.target).trigger("tap"); }); //$('.product_banner').height(w_height); //$('.product_list').height(w_height); });