usagizmo
12/20/2017 - 12:03 PM

Smooth scroll with jQuery

$('a[href^="#"]').on('click', ev => {
  ev.preventDefault()
  const scrollTop = $($(this).attr('href')).offset().top
  $('html, body').animate({ scrollTop })
})