Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // requires jQuery scrolls smoothly to all href ids e.g. <a href="#some_div_id">scroll to div</a>
  2. $(function() {
  3. $('a[href*=#]:not([href=#])').click(function() {
  4. var target = $(this.hash);
  5. target = target.length ? target : $('[name=' + this.hash.substr(1) +']');
  6. if (target.length) {
  7. $('html,body').animate({
  8. scrollTop: target.offset().top
  9. }, 1000);
  10. return false;
  11. }
  12. });
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement