Team:SYSU-Software/hm-overview.js

From 2014.igem.org

(Difference between revisions)
(Created page with " window.onload = function(){ var count = 1, wheel = true; document.getElementById('showpics').className = 'rotate'; document.getElement...")
Line 1: Line 1:
-
 
+
window.onload = function(){
-
    window.onload = function(){
+
         var count = parseInt(window.location.pathname.slice(-1)),
-
         var count = 1,
+
             wheel = true;
             wheel = true;
         document.getElementById('showpics').className = 'rotate';
         document.getElementById('showpics').className = 'rotate';
-
         document.getElementById('bodyContent').className="hm-part1";
+
         count = (count>0 && count<5)? count : 1;
 +
        document.body.className="hm-part"+count;
         $(window).mousewheel(function(e, delta){
         $(window).mousewheel(function(e, delta){
             if(wheel){
             if(wheel){
Line 16: Line 16:
                     count = count%4 || 4;
                     count = count%4 || 4;
                 }
                 }
-
               document.getElementById('bodyContent').className = 'hm-part'+count;
+
               document.body.className = 'hm-part'+count;
                 setTimeout(function(){
                 setTimeout(function(){
                     wheel = true;
                     wheel = true;
-
                 }, 1500)
+
                 }, 600)
             }
             }
              
              
         });
         });
     }
     }

Revision as of 03:35, 17 October 2014

window.onload = function(){
       var count = parseInt(window.location.pathname.slice(-1)),
           wheel = true;
       document.getElementById('showpics').className = 'rotate';
       count = (count>0 && count<5)? count : 1; 
       document.body.className="hm-part"+count;
       $(window).mousewheel(function(e, delta){
           if(wheel){
               wheel = false;
               if(count==1 && delta>0){
                   count=1;
               } else if(count==4 && delta<0){
                   count=4;
               } else {
                   delta > 0 ? count-- : count++;
                   count = count%4 || 4;
               }
              document.body.className = 'hm-part'+count;
               setTimeout(function(){
                   wheel = true;
               }, 600)
           }
           
       });
   }