Posted By

boton on 11/29/11


Tagged


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

mattfarrow
robfahy
burnandbass
spee66
BrockSamsom
Internet-Uzver


Smooth scrolling for internal links


 / Published in: jQuery
 

URL: http://imakewebthings.github.com/jquery-waypoints/

Smooth scrolling for internal links

  1. $('a[href^="#"]').bind('click.smoothscroll',function (e) {
  2. e.preventDefault();
  3.  
  4. var anchor = this.hash,
  5. $target = $(target);
  6.  
  7. $('html, body').stop().animate({
  8. 'scrollTop': $target.offset().top
  9. }, 500, 'swing', function () {
  10. window.location.hash = anchor;
  11. });
  12.  
  13. });

Report this snippet  

You need to login to post a comment.