Advertisement
srikat

Untitled

Jul 13th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. // Select all links with hashes
  2. $('a[href*="#"]')
  3. // Remove links that don't actually link to anything
  4. .not('[href="#"]')
  5. .not('[href="#0"]')
  6. .click(function (e) {
  7. e.preventDefault();
  8. var offset = 117;
  9. var target = this.hash;
  10. // if ($(this).data('offset') != undefined) offset = $(this).data('offset');
  11. $('html, body').stop().animate({
  12. 'scrollTop': $(target).offset().top - offset
  13. }, 500, 'swing', function() {
  14. // window.location.hash = target;
  15. });
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement