$(window).load(function(){ var winw = $(window).width(); var winh = $(window).height(); imgsload.set(); /*PC端打开效果*/ if(winw>=980){ new WOW().init({}); } /*头部*/ var HeaderHeight = $('#header').outerHeight(); $('#header-black').height(HeaderHeight); $('#phone-nav').css('top',HeaderHeight); $('#phone-search').css({'top':HeaderHeight}); }) $(window).resize(function(){ var winw = $(window).width(); var winh = $(window).height(); imgsload.set(); /*PC端打开效果*/ if(winw>=980){ new WOW().init({}); } /*头部*/ var HeaderHeight = $('#header').outerHeight(); $('#header-black').height(HeaderHeight); $('#phone-nav').css('top',HeaderHeight); $('#phone-search').css({'top':HeaderHeight}); }) //简单的懒加载图片 var imgsload={ img: 'img[data-src]', end: 0, set: function(){ if(imgsload.end) return; imgsload.end=1; var height=$(window).height(); var scroll=$(window).scrollTop()||$('body,html').scrollTop(); $(imgsload.img).each(function(){ var h=$(this).offset().top; if($(this).is(':visible')&&h<=scroll+height){ $(this).attr('src', $(this).attr('data-src')); $(this).removeAttr('data-src'); }else{ imgsload.end=0; } }); } } function HeaderTarget(obj){//头部下拉 if(obj.hasClass('on')){ obj.removeClass('on'); $('#phone-nav').stop(true,true).slideUp(); }else{ obj.addClass('on'); $('#phone-nav').stop(true,true).slideDown(); } } function IndexTwoVideo(){//弹出视频 if($('#video').hasClass('on')){ $('#video').removeClass('on'); $('#video video').attr('src',''); $('#video').hide(); }else{ $('#video').addClass('on'); var src = $('#video').attr('video'); $('#video video').attr('src',src); $('#video').show(); } } function IndexTwoVideo2(obj){//视频显示 obj.addClass('on'); obj.find('img').hide(); obj.find('video').show(); } function PhoneInsideCategory(obj){//手机版分类栏跳转 var src = '/products/i-'+obj.val()+'/'; window.location.href = src; } function ProductsDetailImg(src){//产品详细-小图点击变大图 $('#products .left img').attr('src',src); } /*发展历程*/ function Development(){ //发展历程 var Development = jQuery('#about-history'), Item = jQuery('.item',Development), Progress = jQuery('.about-progress .i',Development), Index = 0, Timer,Moving; Action(Index); //Auto(5000); Item.hover(function(){ Index = jQuery(this).index(); clearTimeout(Timer); clearTimeout(Moving); Action(Index); ActionProgress(Index,500); },function(){ //Auto(5000); }); function Action(i){ Item.eq(i).addClass('on'); /*Item.eq(i).children('.default').addClass('flipOutY').removeClass('flipInX'); Item.eq(i).children('.bg').addClass('flipInX').removeClass('flipOutY'); Item.eq(i).children('.development').addClass('flipInX').removeClass('flipOutY');*/ Item.eq(i).siblings(Item).removeClass('on'); /*Item.eq(i).siblings(Item).children('.default').removeClass('flipOutY'); Item.eq(i).siblings(Item).children('.bg').removeClass('flipInX'); Item.eq(i).siblings(Item).children('.development').removeClass('flipInX');*/ } function ActionProgress(i,speed,callbacks){ var Distance = Item.outerHeight(true); Progress.stop(false,true).animate({height:Distance*i-25},speed,'linear'); Moving = setTimeout(function(){ jQuery.isFunction(callbacks) && callbacks(); }, speed); } function Auto(time){ Timer = setTimeout(function(){ Index >= Item.length-1 ? Index = 0 : Index++; ActionProgress(Index,5000,function(){ Action(Index); Auto(!isNaN(time) ? time : 5000); }); }, !isNaN(time) ? time : 5000); } } /*悬浮框*/ function toTop(){ jQuery('html,body').animate({scrollTop:0},400); } function OptHot(A){ var Hotline = jQuery('#hotline'); if(A){ Hotline.parents('.item').addClass('open'); }else{ Hotline.parents('.item').removeClass('open'); } } function OptOnline(A){ var Online = jQuery('#online'); if(A){ Online.parents('.item').addClass('open'); }else{ Online.parents('.item').removeClass('open'); } } function OptQrcode(A){ var Qrcode = jQuery('#wechat-qrcode'); switch(A){ case 0: Qrcode.stop(true,false).slideUp(300); break; case 1: Qrcode.stop(true,false).slideDown(300); break; default : Qrcode.stop(true,false).slideToggle(300); break; } }