Skip to content

Instantly share code, notes, and snippets.

View pensart's full-sized avatar

Guy Pensart pensart

View GitHub Profile
@pensart
pensart / Smooth scroll on hash targets
Last active February 24, 2017 08:28
Smooth scroll on # targets and show no hash in the url
// Warning, this wil target all # elements
// Even when they do not link to a location on the page
// For example, #next-arrow will also prevent the default behavior
$('a[href^="#"]').on('click', function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);