window.onload=function(){ var obtn=document.getelementbyid("btn"); var h=document.documentelement.clientheight; var timer=null; var istop=true; window.onscroll=function(){ var top=document.documentelement.scrolltop || document.body.scrolltop; if(top>=h){ obtn.style.display="block"; }else{ obtn.style.display="none"; } //document.documentelement.scrolltop=h+document.documentelement.scrolltop; if(!istop){clearinterval(timer)} istop=false; obtn.onclick=function(){ timer=setinterval(function(){ var otop=document.documentelement.scrolltop || document.body.scrolltop; var speed=math.floor(-otop/2); document.documentelement.scrolltop=document.body.scrolltop=otop+speed; istop=true; if(otop==0){ clearinterval(timer); } },100) } } } $(function(){ $(".nav li").each(function(){ $(this).hover(function(){ $(this).find(".subnav").stop().slidedown(); },function(){ $(this).find(".subnav").stop().slideup(); }) }) var flag=true; $(".confix").click(function(){ if(flag){ $(".conlist").animate({right:"45px"},1000); flag=false; }else{ $(".conlist").animate({right:"-245px"},1000); flag=true; } }) })