Team:StanfordBrownSpelman/jquery.scroll

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
$(document).ready(function() {
$(document).ready(function() {
 +
 +
var scrollSpeed = 700;
$("#team").click(function() {
$("#team").click(function() {
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#teamNoodle").offset().top
         scrollTop: $("#teamNoodle").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 11: Line 13:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#place").offset().top + 15
         scrollTop: $("#place").offset().top + 15
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 18: Line 20:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#splash").offset().top
         scrollTop: $("#splash").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 25: Line 27:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#precontact").offset().top
         scrollTop: $("#precontact").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 32: Line 34:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#images").offset().top
         scrollTop: $("#images").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 39: Line 41:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#int").offset().top
         scrollTop: $("#int").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 46: Line 48:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#results").offset().top
         scrollTop: $("#results").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 53: Line 55:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#process").offset().top
         scrollTop: $("#process").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 60: Line 62:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#references").offset().top
         scrollTop: $("#references").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 67: Line 69:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#header").offset().top - $("#header").height()
         scrollTop: $("#header").offset().top - $("#header").height()
-
     }, 700);
+
     }, scrollSpeed);
     return false;
     return false;
     });
     });
Line 73: Line 75:
$("#top2").click(function() {
$("#top2").click(function() {
     $('body, html').animate({
     $('body, html').animate({
-
         scrollTop: '1px'});
+
         scrollTop: '0px'}, scrollSpeed);
     return false;
     return false;
     });
     });
Line 80: Line 82:
     $('body, html').animate({
     $('body, html').animate({
         scrollTop: $("#test2").offset().top
         scrollTop: $("#test2").offset().top
-
     }, 700);
+
     }, scrollSpeed);
     return false;  
     return false;  
     });
     });
             });
             });

Revision as of 18:49, 10 October 2014

$(document).ready(function() {

var scrollSpeed = 700;

$("#team").click(function() {

   $('body, html').animate({
       scrollTop: $("#teamNoodle").offset().top
   }, scrollSpeed);
   return false;
   });

$("#projects").click(function() {

   $('body, html').animate({
       scrollTop: $("#place").offset().top + 15
   }, scrollSpeed);
   return false;
   });
   

$("#wiki").click(function() {

   $('body, html').animate({
       scrollTop: $("#splash").offset().top
   }, scrollSpeed);
   return false;
   });
   

$("#contact").click(function() {

   $('body, html').animate({
       scrollTop: $("#precontact").offset().top
   }, scrollSpeed);
   return false;
   });
   

$("#pics").click(function() {

   $('body, html').animate({
       scrollTop: $("#images").offset().top
   }, scrollSpeed);
   return false;
   });

$("#intro").click(function() {

   $('body, html').animate({
       scrollTop: $("#int").offset().top
   }, scrollSpeed);
   return false;
   });
   

$("#data").click(function() {

   $('body, html').animate({
       scrollTop: $("#results").offset().top
   }, scrollSpeed);
   return false;
   });
   

$("#methods").click(function() {

   $('body, html').animate({
       scrollTop: $("#process").offset().top
   }, scrollSpeed);
   return false;
   });
   

$("#links").click(function() {

   $('body, html').animate({
       scrollTop: $("#references").offset().top
   }, scrollSpeed);
   return false;
   });

$("#top").click(function() {

   $('body, html').animate({
       scrollTop: $("#header").offset().top - $("#header").height()
   }, scrollSpeed);
   return false;
   });

$("#top2").click(function() {

   $('body, html').animate({
       scrollTop: '0px'}, scrollSpeed);
   return false;
   });

$("#contact").click(function() {

   $('body, html').animate({
       scrollTop: $("#test2").offset().top
   }, scrollSpeed);
   return false; 
   });
            });