Team:AHUT China/scrolltop

From 2014.igem.org

(Difference between revisions)
(Created page with "function goTopEx(){ var obj=document.getElementById("goTopBtn"); function getScrollTop(){ return document.documentElement.scrollTop; }...")
 
Line 7: Line 7:
                 document.documentElement.scrollTop=value;
                 document.documentElement.scrollTop=value;
             }     
             }     
-
         window.onscroll=function(){getScrollTop()>0?obj.style.background="url(images/AHUT_CHINA_2014_left_bar_top.png) 0 -130px":obj.style.background="url(images/AHUT_CHINA_2014_left_bar_app.png) 0 -130px";}
+
         window.onscroll=function(){getScrollTop()>0?obj.style.background="url(https://static.igem.org/mediawiki/2014/6/65/AHUT_CHINA_2014_left_bar_top.png) 0 -130px":obj.style.background="url(https://static.igem.org/mediawiki/2014/1/1f/AHUT_CHINA_2014_left_bar_app.png) 0 -130px";}
         obj.onclick=function(){
         obj.onclick=function(){
             var goTop=setInterval(scrollMove,10);
             var goTop=setInterval(scrollMove,10);

Latest revision as of 03:41, 17 October 2014

function goTopEx(){

       var obj=document.getElementById("goTopBtn");
       function getScrollTop(){
               return document.documentElement.scrollTop;
           }
       function setScrollTop(value){
               document.documentElement.scrollTop=value;
           }    
       window.onscroll=function(){getScrollTop()>0?obj.style.background="url(AHUT_CHINA_2014_left_bar_top.png) 0 -130px":obj.style.background="url(AHUT_CHINA_2014_left_bar_app.png) 0 -130px";}
       obj.onclick=function(){
           var goTop=setInterval(scrollMove,10);
           function scrollMove(){
                   setScrollTop(getScrollTop()/1.1);
                   if(getScrollTop()<1)clearInterval(goTop);
               }
       }
   }