Posted By


mishified on 07/27/17

Tagged


Statistics


Viewed 595 times
Favorited by 0 user(s)

Smooth Scrolling


/ Published in: JavaScript
Save to your folder(s)

Place into before body end tag


Copy this code and paste it in your HTML
  1. <script>
  2. lp.jQuery(function($) {
  3.  
  4. // The speed of the scroll in milliseconds
  5. var speed = 1000;
  6.  
  7. // Find links that are #anchors and scroll to them
  8. $('a[href^=#]')
  9. .not('.lp-pom-form .lp-pom-button')
  10. .unbind('click.smoothScroll')
  11. .bind('click.smoothScroll', function(event) {
  12. event.preventDefault();
  13. $('html, body').animate({ scrollTop: $( $(this).attr('href') ).offset().top }, speed);
  14. });
  15. });
  16. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.