Skip to content

Instantly share code, notes, and snippets.

@iamravenous
Last active November 6, 2020 05:05
Show Gist options
  • Save iamravenous/4a1545dc3ccd24abf89e to your computer and use it in GitHub Desktop.
Save iamravenous/4a1545dc3ccd24abf89e to your computer and use it in GitHub Desktop.
Hash change on scroll with Bootstrap 3 Scrollspy
/*
* Scrollspy Hashchange
* Hash change on scroll with Bootstrap 3 Scrollspy
* Author: Franco Moya - @iamravenous
*/
$(window).on('activate.bs.scrollspy', function (e) {
history.replaceState({}, "", $("a[href^='#']", e.target).attr("href"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment