Skip to content

Instantly share code, notes, and snippets.

View iamravenous's full-sized avatar

Franco Moya iamravenous

View GitHub Profile
@iamravenous
iamravenous / jquery.scrollspy-hashchange.js
Last active November 6, 2020 05:05
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"));
});
@iamravenous
iamravenous / jquery.smooth-scroll-pageload.js
Last active April 23, 2024 09:05
Smooth scrolling on page load if URL have a hash
/*
* Smooth Scroll on Pageload
* Smooth scrolling on page load if URL have a hash
* Author: Franco Moya - @iamravenous
*/
if (window.location.hash) {
var hash = window.location.hash;
if ($(hash).length) {