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

 
Line 12: Line 12:
 
     });
 
     });
 
   });
 
   });
 
  $('html, body').animate({
 
    scrollTop: 20
 
  }, 0);
 
 
});
 
});

Latest revision as of 14:14, 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;
   });
 });

});