Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Tommaso Vietina
Added: Apr 20, 2018 9:52 AM
Modified: Apr 20, 2018 9:53 AM
Views: 16
Tags: no tags
  1. $(document).on('click', 'a[href^="#"]', function (event) {
  2.     event.preventDefault();
  3.  
  4.     $('html, body').animate({
  5.         scrollTop: $($.attr(this, 'href')).offset().top
  6.     }, 500);
  7. });