Difference between revisions of "Team:Leiden/scripts/smoothscrolling"

(Created page with "$(document).ready(function(){ var smoothLinks = $("a.smooth"); smoothLinks.on('click', function(event) { event.preventDefault(); var hash = this.hash; $('htm...")
 
Line 12: Line 12:
 
     });
 
     });
 
   });
 
   });
 +
 +
  $('html, body').animate({
 +
    scrollTop: 20
 +
  }, 0);
 
});
 
});

Revision as of 14:13, 15 June 2016

$(document).ready(function(){

 var smoothLinks = $("a.smooth");
 smoothLinks.on('click', function(event) {
   event.preventDefault();
   var hash = this.hash;
   $('html, body').animate({
     scrollTop: $(hash).offset().top
   }, 900, function(){
     window.location.hash = hash;
   });
 });
 $('html, body').animate({
   scrollTop: 20
 }, 0);

});