Template:Team:Berkeley/scrollspyOffset.js

From 2013.igem.org

(Difference between revisions)
Line 1: Line 1:
-
var offset = 80;
+
$('#navbar ul li a').bind('click', function(e) {
-
 
+
     e.preventDefault();
-
$('.navbar li a').click(function(event) {
+
     $('html, body').animate({
-
     event.preventDefault();
+
        scrollTop: $(this.hash).offset().top -190
-
     $($(this).attr('href'))[0].scrollIntoView();
+
     }, 300);
-
     scrollBy(0, -offset);
+
    // edit: Opera requires the "html" elm. animated
});
});

Revision as of 02:07, 28 October 2013

$('#navbar ul li a').bind('click', function(e) {

   e.preventDefault();
   $('html, body').animate({
       scrollTop: $(this.hash).offset().top -190
   }, 300);
   // edit: Opera requires the "html" elm. animated

});