// 定义全局变量 var iddiv=""; var showdiv=false; var posY = 0; var posYold=0; var page; var ele9scrll=0; var ele1,ele22,ele3,ele4,ele5,ele6,ele7,ele8,ele9,ele10; var ele1_h,ele2_h,ele3_h,ele_h4,ele5_h,ele6_h,ele7_h,ele8_h,ele9_h,ele10_h; var leftnva var ele9bg function calcParallax(tileheight, speedratio, scrollposition) { return ((tileheight - (Math.floor(scrollposition / speedratio) % (tileheight+1)))-tileheight); } function initParalaxPage(){ page.bind('scroll',function() { var scrollid = window.setTimeout(function(){ window.clearTimeout(scrollid); scrollfun(); },1) }); try{ jQuery(window).mousewheel(function(event, delta, deltaX, deltaY){ if(delta < 0) page.scrollTop(page.scrollTop() + 85); else if(delta > 0) page.scrollTop(page.scrollTop() -85); //clearInterval(set) //$(".auto .on").removeClass("o"); //$(".auto .off").addClass("off o"); return false; }) } catch(e) {} //ipad s if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) { //ipad拖动事件 var xx,yy,_left1,_left2; var aaa=false; document.addEventListener('touchstart', function(e) { xx=e.touches[0].pageY _left1=e.touches[0].pageX }) document.addEventListener('touchmove', function(e) { //alert(e.touches[0].pageY) e.stopPropagation(); e.preventDefault(); yy=e.touches[0].pageY _left2=e.touches[0].pageX aaa=true; funcxx() return false; }) document.addEventListener('touchend', function(e) { }) function funcxx() { //alert(1) if(aaa){ if(yy>xx) { page.scrollTop(page.scrollTop() - Math.abs(yy-xx)); } else { page.scrollTop(page.scrollTop() + Math.abs(yy-xx)); } if(_left1<_left2) { //alert(_left1) page.scrollLeft(page.scrollLeft() - Math.abs(_left2-_left1)); } else { page.scrollLeft(page.scrollLeft() + Math.abs(_left2-_left1)); } $(".scrollbox").stop().animate({marginLeft:-(page.scrollLeft())},100); aaa=true return false; } } //ipad end } } // } function scrollfun(){ try{ posY=page.scrollTop(); } catch(e) {} var layer1 = calcParallax(20000, -0.6, posY); var layer2 = calcParallax(20000, 0.6, posY); var layer3 = -(posY) var layer4 = Math.floor(calcParallax(20000, 1.5, posY)); var layer13 = calcParallax(20000, 1.2,posY); if(Math.abs(layer3)>200){ $(".leftnav li.lefttop").fadeIn(); leftnva=$(".leftnav li.lefttop").position().top+60; } else { $(".leftnav li.lefttop").fadeOut(); } leftnva=$(".leftnav").position().top+60; if(Math.abs(layer3)>=ele1-leftnva){ $(".leftnav li").find("a").removeClass("cur") } if(Math.abs(layer3)>=ele22-leftnva){ $(".leftnav li").find("a").removeClass("cur") $(".leftnav li").eq(0).find("a").addClass("cur") } if(Math.abs(layer3)>=ele3-leftnva){ $(".leftnav li").find("a").removeClass("cur") $(".leftnav li").eq(1).find("a").addClass("cur") } if(Math.abs(layer3)>=ele4-leftnva){ $(".leftnav li").find("a").removeClass("cur") $(".leftnav li").eq(2).find("a").addClass("cur") } if(Math.abs(layer3)>=ele5-leftnva){ $(".leftnav li").find("a").removeClass("cur") $(".leftnav li").eq(3).find("a").addClass("cur") } //动作 if(Modernizr.canvas) {try{ $(".scrollbox").stop().animate({marginTop:layer3,marginLeft:-(page.scrollLeft())},{queue:false, duration: 1100}); } catch(e) {} } else { } //p1 if(Math.abs(layer3)ele1-ele1_h/1.5 ) { dl1() d1=false; } else { undl1() d1=true; } //p2 if(Math.abs(layer3)ele22-ele2_h/1.5 ) { dl2() d2=false; } else { undl2() d2=true; } //p3 if(Math.abs(layer3)ele3-ele3_h/1.5 ) { dl3() d3=false; } else { undl3() d3=true; } //p4 if(Math.abs(layer3)ele4-ele4_h/1.5 ) { dl4() d4=false; } else { undl4() d4=true; } //p5 if(Math.abs(layer3)ele5-ele5_h/1.5 ) { dl5() d5=false; } else { undl5() d5=true; } /*$(".header").css({marginTop:layer13}); $(".ele1 ").css({marginTop:layer13}); $(".ele2 ").css({marginTop:layer13}); $(".ele3 ").css({marginTop:layer13}); $(".ele4 ").css({marginTop:layer13}); $(".ele5 ").css({marginTop:layer13}); $(".footer").css({marginTop:layer13}); */ //alert(posY) try{ posYold = page.scrollTop(); } catch(e) {} } var d1=true; var d2=true; var d3=true; var d4=true; var d5=true; function dl1(){ if(d1) { clearInterval(dltims) var dlnum=0 //alert(1) var dltims=setInterval(function(){ dlnum++; if(dlnum==1) { $(".webele1 .webbox .tit h2").stop().animate({left:0,opacity:1},1000) $(".webele1 .webbox .tit div").stop().animate({left:0,opacity:1},1000) $(".web_top1 dl dt").animate({width:64,opacity:1},500); $(".web_top1 dl dd").animate({left:0,opacity:1},800); } if(dlnum==5){Parabola($(".web_top1 .canvasbox"))} if(dlnum==10) { $(".web_top2 dl dt").animate({width:64,opacity:1},500); $(".web_top2 dl dd").animate({left:0,opacity:1},800); } if(dlnum==15){Parabola($(".web_top2 .canvasbox"))} if(dlnum==20) { $(".web_top3 dl dt").animate({width:64,opacity:1},500); $(".web_top3 dl dd").animate({left:0,opacity:1},800); } if(dlnum==25){Parabola($(".web_top3 .canvasbox"))} if(dlnum==30) { $(".web_top4 dl dt").animate({width:64,opacity:1},500); $(".web_top4 dl dd").animate({left:0,opacity:1},800); } if(dlnum>31){ clearInterval(dltims)} },60) } } function undl1(){ if(!d1) { $(".canvasbox").html("") $(".webele1 .webbox .tit h2").css({left:-100}) $(".webele1 .webbox .tit div").css({left:100}) $(".web_top1 dl dt").css({width:0,opacity:0}); $(".web_top1 dl dd").css({left:200,opacity:0}); $(".web_top2 dl dt").css({width:0,opacity:0}); $(".web_top2 dl dd").css({left:200,opacity:0}); $(".web_top3 dl dt").css({width:0,opacity:0}); $(".web_top3 dl dd").css({left:200,opacity:0}); $(".web_top4 dl dt").css({width:0,opacity:0}); $(".web_top4 dl dd").css({left:200,opacity:0}); } } //抛物线函数 var arrayd=[[0,165],[6,152],[15,138],[24,124],[35,112],[46,101], [58,91],[71,81],[84,72],[98,64],[114,58],[129,53], [145,49],[160,45],[176,43],[192,43],[208,44], [224,46],[240,49],[255,53],[270,59]] function Parabola(ele){ clearInterval(timse); ele.html(""); var ii=0; var timse=setInterval(function(){ ii++; //$(".test").html(ii) if(ii>=arrayd.length) { clearInterval(timse); return; } ele.append("") },20) } //抛物线end function dl2(){ if(d2) { $(".webele2 .webbox dd ul li").each(function(i){ $(this).find("span").css({marginTop:-($(this).find("span").height()/2)}) $(this).stop().delay(i*100).animate({opacity:1-(i/30),left:0},500); }) $(".webele2 .webbox dd h2").stop().animate({left:0,opacity:1},500) $(".webele2 .webbox dd .p").stop().animate({left:0,opacity:1},800) $(".webele2 .webbox dd h3").stop().animate({left:0,opacity:1},1200) //alert(1) oneBoxImg(0) } } function undl2(){ if(!d2) { $(".webele2 .webbox dd ul li").each(function(i){ $(".webele2 .webbox dd ul li").eq($(".webele2 .webbox dd ul li").size()-1-i).stop().delay(i*100).animate({opacity:0,left:100},500); }) $(".webele2 .webbox dd h2").stop().animate({left:200,opacity:0},500) $(".webele2 .webbox dd .p").stop().animate({left:-200,opacity:0},800) $(".webele2 .webbox dd h3").stop().animate({left:200,opacity:0},1200) //alert(2) oneBoxImg(1) } } //幻灯片事件 function oneBoxImg(num){ var okl = num; //alert(1) if(okl == 0){ var oImg = $(".webele2 dt img").attr("src"); var arrObj = ""; for(var i=0; i<=24; i++){ arrObj += '
'; }; //$(".planLeImg").css("top",parseInt($(".wecBox2").height()/2)-$(".planLeImg").height()/2); $(".webele2").find(".posLi").remove(""); $(".webele2 dt").append(arrObj); $(".webele2 .posLi").css({"opacity":0}); var eq = 0; for(var k=0; k<=4; k++){ for(var j=0; j<=4; j++){ $(".webele2 .posLi").eq(eq).css({"top":k*101+"px","left":j*86+"px","backgroundPosition":""+-(j*86)+"px "+-(k*101)+"px"}); eq++; }; }; $(".webele2 .posLi").css({ "width":0, "height":0 }); $(".webele2 .posLi").each(function(t){ $(".webele2 .posLi").eq(t).stop().delay(t*50).animate({"opacity":1,"width":"86px","height":"101px"},500); }); }else{ var eq = 0; for(var k=0; k<=4; k++){ for(var j=0; j<=4; j++){ $(".webele2 .posLi").eq(eq).css({"top":k*101+"px","left":j*86+"px","backgroundPosition":""+-(j*86)+"px "+-(k*101)+"px"}); eq++; }; }; $(".webele2 .posLi").css({ "width":86, "height":101 }); $(".webele2 .posLi").each(function(t){ $(".webele2 .posLi").eq(t).stop().delay(t*50).animate({"opacity":0,"width":"0px","height":"0px"},500); }); }; }; function dl3(){ if(d3) { //alert(1) $(".webele3 .left h2").stop().animate({left:0,opacity:1},1000) $(".webele3 .left .p").stop().animate({left:0,opacity:1},1000) $(".webele3 .left h3").stop().animate({left:0,opacity:1},1000) $(".webele3 .right .img1").stop().animate({top:0,opacity:1},1200) $(".webele3 .right .img2").stop().animate({top:0,opacity:1},800) $(".webele3 .right .img3").stop().animate({top:0,opacity:1},500) //$(".cont_3 .dl3").stop().animate({left:0,opacity:1},1000) $(".webele3 .ele3ul li").each(function(i){ $(this).stop().delay(i*100).animate({opacity:1, left:0},800); }) } } function undl3(){ if(!d3) { $(".webele3 .left h2").stop().animate({left:-100,opacity:0},1000) $(".webele3 .left .p").stop().animate({left:-150,opacity:0},1000) $(".webele3 .left h3").stop().animate({left:-200,opacity:0},1000) $(".webele3 .right .img1").stop().animate({top:200,opacity:0},500) $(".webele3 .right .img2").stop().animate({top:-200,opacity:0},800) $(".webele3 .right .img3").stop().animate({top:200,opacity:0},1200) //$(".cont_3 .dl3").stop().animate({left:0,opacity:1},1000) $(".webele3 .ele3ul li").each(function(i){ $(this).stop().delay(i*100).animate({opacity:0, left:100},800); }) } } function dl4(){ if(d4) { //alert(1) $(".webele4 .left").stop().animate({left:-100,opacity:1},1000) $(".webele4 .right h2").stop().animate({left:0,opacity:1},800) $(".webele4 .right .p").stop().animate({left:0,opacity:1},1000) $(".webele4 .right .mouse").stop().animate({left:0,opacity:1},1000) $(".webele4 .right ul").stop().animate({left:0,opacity:1},800,function(){ $(".webele4 .right ul li").each(function(i){ $(this).stop().delay(i*100).animate({opacity:1, top:0},800); }) }) } } function undl4(){ if(!d4) { //alert(2) $(".webele4 .left").stop().animate({left:-500,opacity:0},1000) $(".webele4 .right h2").stop().animate({left:-200,opacity:0},800) $(".webele4 .right .p").stop().animate({left:200,opacity:0},1000) $(".webele4 .right .mouse").stop().animate({left:500,opacity:0},1000) $(".webele4 .right ul").stop().animate({left:0,opacity:0},800,function(){ $(".webele4 .right ul li").each(function(i){ $(this).stop().delay(i*100).animate({opacity:0, top:100},800); }) }) } } function dl5(){ if(d5) { //alert(1) $(".webele5 .right").stop().animate({top:0,opacity:1},1000) $(".webele5 .left h2").stop().animate({left:0,opacity:1},1000) $(".webele5 .left .p1").stop().animate({left:0,opacity:1},800) $(".webele5 .left h3").stop().animate({left:0,opacity:1},1000) $(".webele5 .left .p2").stop().animate({left:0,opacity:1},1000) $(".webele5 .left ul li").each(function(i){ $(this).find("span").css({marginTop:-($(this).find("span").height()/2)}) $(this).stop().delay(i*100).animate({opacity:1-(i/40), top:0},800); }) } } function undl5(){ if(!d5) { //alert(2) //alert(1) $(".webele5 .right").stop().animate({top:-500,opacity:0},1000) $(".webele5 .left h2").stop().animate({left:-100,opacity:0},1000) $(".webele5 .left .p1").stop().animate({left:200,opacity:0},800) $(".webele5 .left h3").stop().animate({left:-200,opacity:0},1000) $(".webele5 .left .p2").stop().animate({left:100,opacity:0},1000) $(".webele5 .left ul li").each(function(i){ $(this).find("span").css({marginTop:-($(this).find("span").height()/2)}) $(this).stop().delay(i*100).animate({opacity:0, top:200},800); }) } } // 不同浏览器滚动条宽度定义 var sl_w=17; var ua = navigator.userAgent.toLowerCase(); var s; s = ua.match(/iPad/i); if(s=="ipad") { sl_w=0; } else{ } /*if($.browser.msie) { sl_w=18; if(($.browser.version == "7.0") || ($.browser.version == "8.0")) { sl_w=19; } } else if($.browser.safari || $.browser.mozilla || $.browser.opera ) { sl_w=17; } else { }*/ // 不同浏览器滚动条宽度定义end var win_w; var win_h; //全站初始化、、 $(document).ready(function(){ $(window).resize(function(){ win_w=$(window).width(); win_h=$(window).height() if(Modernizr.canvas)//if支持html插入scroll { $("#warpscroll").addClass("scroll") } //alert(win_w) if(win_w<=1280) { $(".webele1,.webele2,.webele3,.webele4,.webele5").css({width:1280-sl_w,overflow:"hidden"}); //$(".scroll").css({width:1280-sl_w}) $(".scroll").css({width:win_w-sl_w,height:win_h-sl_w}) } else { $(".webele1,.webele2,.webele3,.webele4,.webele5").css({width:win_w-sl_w,overflow:"hidden"}); $(".scroll").css({width:win_w-sl_w,height:win_h}) } if(win_w<1419) { $(".header").css({"width":win_w-sl_w-30});//,paddingLeft:10,paddingRight:10 $(".footerCnt").css({"width":win_w-sl_w-30});//,paddingLeft:10,paddingRight:10 } else { $(".header").css({"width":1419}); $(".footerCnt").css({"width":1419}); } if(win_w<1260) { $(".header").css({"width":1280-sl_w-30});//,paddingLeft:10,paddingRight:10 $(".footerCnt").css({"width":1280-sl_w-30});//,paddingLeft:10,paddingRight:10 } $(".webele1").css({paddingTop:(win_h-$(".webele1").height())/2}) $(".webele2").css({paddingTop:(win_h-$(".webele2").height())/2}) $(".webele3").css({paddingTop:(win_h-$(".webele3").height())/2}) $(".webele4").css({paddingTop:(win_h-$(".webele4").height())/2}) $(".webele5").css({paddingTop:(win_h-$(".webele5").height())/2,paddingBottom:(win_h-$(".webele5").height())/2-$(".footer").height()}) ele1=186 ele1_h=$(".webele1").outerHeight(); ele22=ele1+ele1_h; ele2_h=$(".webele2").outerHeight(); ele3=ele22+ele2_h ele3_h=$(".webele3").outerHeight(); ele4=ele3+ele3_h ele4_h=$(".webele4").outerHeight(); ele5=ele4+ele4_h ele5_h=$(".webele5").outerHeight(); $(".main_box").css({height:ele5+ele5_h+$(".footer").height()}); scrollfun(); }) $(".show").hide(); $("#website_scroll").height($(window).height()) $(".hide").height($(window).outerHeight()-$(".header").outerHeight()-$(".footer").outerHeight()) window.onload = function() { $(".hide").hide(); $(".show").css({"visibility":"visible"}).fadeIn(); page = $("#website_wrap"); posYold = page.scrollTop(); initParalaxPage(); $(window).resize(); d1=false; d2=false; d3=false; d4=false; d5=false; undl1(); undl2(); undl3(); undl4(); undl5(); d2=true; d3=true; d4=true; d5=true; }; }); $(document).ready(function(){ $(".lefttop").click(function(){ page.scrollTop(0); scrollfun(); }) $(".web_top1 dl dd h2 , .leftn1").click(function(){ page.scrollTop(ele22-100); scrollfun(); $(".leftnav li a").removeClass("cur") $(".leftnav li.leftn1 a").addClass("cur") }) $(".web_top2 dl dd h2 , .leftn2").click(function(){ page.scrollTop(ele3-100); scrollfun(); $(".leftnav li a").removeClass("cur") $(".leftnav li.leftn2 a").addClass("cur") }) $(".web_top3 dl dd h2 , .leftn3").click(function(){ page.scrollTop(ele4-100); scrollfun(); $(".leftnav li a").removeClass("cur") $(".leftnav li.leftn3 a").addClass("cur") }) $(".web_top4 dl dd h2 , .leftn4").click(function(){ page.scrollTop(ele5-100); scrollfun(); $(".leftnav li a").removeClass("cur") $(".leftnav li.leftn4 a").addClass("cur") }) })