var index ={ "part1_init":0, "part2_init":0, "part3_init":0, "part4_init":0, "part6_init":0, init:function(){ //$("#top-menu").fadeIn("slow"); var self = this; $(document).scroll(function() { var scroH = $(document).scrollTop(); //滚动高度 //var viewH = $(window).height(); //可见高度 // var contentH = $(document).height(); //内容高度 // console.log(scroH); // if(scroH <=10){ $("#header").fadeIn("slow"); }else{ $("#header").fadeOut("slow"); } if(self.part4_init == 0 && scroH >=0){ self.part4_init = 1; $("#animate2").fadeIn(3000); } if(self.part1_init == 0 && scroH >=0){ self.part1_init = 1; TweenLite.to("#animate7", 2, {'margin-top':"24px",ease:Power1.easeInOut}); TweenLite.to("#animate7", 5, { "color":"#000" }); TweenLite.to("#animate2", 2, { 'width':"42%",delay:0.3, onComplete: (param) => { gsap.to('#animate8', 1, { autoAlpha: 1, // autoAlpha 为 1 时元素可见,为 0 时元素 visibility: hidden; ,该选项性能优于 opacity 的变化 scale: 1 , // 缩放由 0 达到 1 transformOrigin: 'center bottom', // 动画中心 }); }, onCompleteParams: [] // ease:Back.easeIn, }); TweenLite.to("#animate2",4,{opacity:1}); } if(self.part2_init == 0 && scroH >=680){ self.part2_init = 1; $("#animate3").fadeIn(2000); TweenLite.to("#animate3", 2, {'width': 1230}); } if(self.part3_init == 0 && scroH >=1400){ self.part3_init = 1; TweenLite.to("#animate4", 1, {height: 280}); TweenLite.to("#animate5", 1.5, {height: 280}); TweenLite.to("#animate6", 2, {height: 280}); $("#animate4").fadeIn(2000); $("#animate5").fadeIn(2000); $("#animate6").fadeIn(2000); TweenLite.to("#animate9", 1, { 'width':"443px", }); } /* if (contentH - (scroH + viewH) <= 100){ //距离底部高度小于100px } if (contentH == (scroH + viewH)){ //滚动条滑到底部啦 }*/ }); }, 'part2-event':function(id){ $("#part2-pic ul li").removeClass("part2-active") //$("#part2-pic ul li:first").addClass("part2-active") $("#"+id).parent().addClass("part2-active") $(".part2-intor").hide(); //$(".part2-intor:first").fadeIn(); $("#"+id+"-intro").fadeIn(); }, 'part6-event':function(ul_obj){ $("#part6-con-2 ul li").removeClass("part6-active1"); $("#part6-con-2 ul li").removeClass("part6-active"); ul_obj.find("li:first").addClass("part6-active1"); ul_obj.find("li:last").addClass("part6-active"); var id = ul_obj.attr("n"); $("#part6-con-1 img").hide(); $("#part6-"+id).fadeIn(); } }