Template:Team:Berkeley/scrollspyOffset.js

From 2013.igem.org

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

Latest revision as of 16:55, 28 October 2013

var offset = 81;

$('#navbar li a').click(function(event) {

   event.preventDefault();
   $($(this).attr('href'))[0].scrollIntoView();
   scrollBy(0, -offset);

});