Localscroll
Il codice è semplice e lineare:
$(document).on('click', 'a[href^="#"]', function (event) { event.preventDefault(); $('html, body').animate({ scrollTop: ( $($.attr(this, 'href')).offset().top - 100 ) }, 500); });
E dove a[href^="#"] sono i link con ancore.
a[href^="#"]
Last updated 4 years ago