djvaij
8/13/2016 - 10:49 AM

[jQuery scroll to element] #javascript #js #jquery

[jQuery scroll to element] #javascript #js #jquery

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

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

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