Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. If your target element does not have an ID, and you're linking to it by its name, use this:
  2.  
  3.  
  4. $('a').click(function(){
  5. $('html, body').animate({
  6. scrollTop: $('[name="' + $.attr(this, 'href').substr(1) + '"]').offset().top
  7. }, 500);
  8. return false;
  9. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement