0

Jquery smooth scroll not working for my code. It jumps to the correct place, but does not scroll smoothly. Below is my codepen I have created, can anyone figure out what is wrong with it?

$(document).ready(function(){
$('a[href^="#"]').on('click',function (e) {
    e.preventDefault();

    var target = this.hash;
    var $target = $(target);

    $('html, body').stop().animate({
        'scrollTop': $target.offset().top
    }, 900, 'swing', function () {
        window.location.hash = target;
    });
});
});

https://codepen.io/anon/pen/BdKvva

Thanks

RAUSHAN KUMAR
  • 5,846
  • 4
  • 34
  • 70
RA19
  • 709
  • 7
  • 28

0 Answers0