// javascript document $(function(){ var w=window.innerwidth || document.documentelement.clientwidth || document.body.clientwidth; var h=window.innerheight || document.documentelement.clientheight || document.body.clientheight; /*header*/ $(".indexbox").css({"height":h,"width":w}); $("body").css({"position":"fixed","top":0,"left":0}); //向下按钮动画 /*function scrollbtn(){ $(".back_all0 img").css({"bottom":30,"opacity":1}); $(".scrollbottombtn").each(function(){ $(this).find("span").eq(0).animate({"bottom":0,"opacity":0},400); $(this).find("span").eq(1).delay(120).animate({"bottom":0,"opacity":0},400); $(this).find("span").eq(2).delay(240).animate({"bottom":0,"opacity":0},400); }); } var time=setinterval(scrollbtn,2000);*/ //$(".indexrightnav").css({"top":1.5*h}) var isff = navigator.useragent.tolowercase().indexof("firefox")>=0; var upordown = ""; var s=0; var sl=$(".indexbox").length; var lastsct; $("img").load(function(){ if($(".indexboxlast")){ $(".indexboxlast").css({"height":"auto"}); lastsct=$(".indexboxlast").innerheight() }; }) //滚动事件>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>start //判断是否为火狐 if (isff) { document.addeventlistener('dommousescroll', function (e) { var e = e || window.event; upordown = e.detail < 0 ? "up" : "down"; //console.log(upordown) scrollfun(upordown); }); } else { document.onmousewheel = function (e) { var e = e || window.event; upordown = e.wheeldelta > 0 ? "up" : "down"; //console.log(upordown); scrollfun(upordown); } } //滑动事件 //屏蔽手机自带滑动效果 document.queryselector('body').addeventlistener('touchmove', function (ev) { ev.preventdefault(); }); var banner_start_x,banner_start_y,banner_end_x,banner_end_y,timestart,timeend; $(".indexbox").on("touchstart",function(e){ var d_start=new date(); timestart=d_start.gettime(); banner_start_x = e.originalevent.targettouches[0].clientx; banner_start_y = e.originalevent.targettouches[0].clienty; }); $(".indexbox").on("touchmove",function(e){ e.preventdefault() banner_end_x = e.originalevent.targettouches[0].clientx; banner_end_y = e.originalevent.targettouches[0].clienty; }); $(".indexbox").on("touchend",function(){ var d_end=new date(); timeend=d_end.gettime(); var move_x=banner_end_x-banner_start_x; var move_y=banner_end_y-banner_start_y; var move_time=timeend-timestart; if((move_y<0)&&(-move_y>100)&&math.abs(move_y)>math.abs(move_x)&&move_time>100){ //console.log("下滑"); scrollfun("down"); } if(move_y>0&&(move_y>100)&&math.abs(move_y)>math.abs(move_x)&&move_time>100){ //console.log("上滑"); scrollfun("up"); } /*if((move_y<0)&&(-move_y>100)){ //console.log("下滑"); scrollfun("down"); } if(move_y>0&&(move_y>100)){ //console.log("上滑"); scrollfun("up"); }*/ //alert(banner_start_y+","+banner_end_y) }); //$(".indexrightnav dl dd").eq(0).addclass("active") //向下滚动动画 function scrollhandown(s){ if($(".indexboxlast")){ //console.log("含多余"+lastsct) if(s==sl){ $("body").animate({"top":-h*(s-1)-lastsct},600); $(".header").animate({opacity:0},500); //console.log("最后一页"+lastsct) }else{ $("body").animate({"top":-h*s},600); $(".header").animate({opacity:1},500); } }else{ $("body").animate({"top":-h*s},600); $(".header").animate({opacity:1},500); } if(s!=0){ $(".indexrightnav dl dd").removeclass("active").eq(s).addclass("active"); } } //向上滚动动画 function scrollhanup(s){ $("body").animate({"top":-h*s},600); $(".header").animate({opacity:1},500); if(s!=0){ $(".indexrightnav dl dd").removeclass("active").eq(s).addclass("active"); } else{ $(".indexrightnav dl dd").removeclass("active").eq(0).addclass("active"); } } /*function scrollmenu(s){ if(s!=0){ $(".slide .txt").eq(s).animate({"opacity":1,top:"50%"},1500) }else{ $(".slide .txt").stop(true,true).animate({"opacity":0,top:"0%"},100) } }*/ function scrollfun(ore){ if(ore=="down"){ if(!$("body").is(":animated")){ if(s0){ s--; scrollhanup(s); //scrollmenu(s) } } } } //滚动事件>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>end //点击右边按钮事件 $(".back_all").click(function(){ var righti=$(".back_all").index(this); if(rightis){ scrollhanup(righti); } s=righti; }); $(".banner_scroll_btn").click(function(){ if(!$("body").is(":animated")){ if(ss){ scrollhandown(righti); } if(righti