Skip to content

Instantly share code, notes, and snippets.

View julian-kuroiwa's full-sized avatar
🚀

Julian Kuroiwa julian-kuroiwa

🚀
View GitHub Profile
@aaronfischer
aaronfischer / smoothscroll.js
Last active August 23, 2018 19:19
Smooth Scroll / Scroll to Section on Load
/* ----------------------------------------------------------------------------------------------------------
03 scroll to #section-id-of-div
---------------------------------------------------------------------------------------------------------- */
function smoothScroll(el, target){
// if the hash is in the URL but not on the page... ex #cosmetic-surgery but not #section-this-div
if(el !== null){
var $this = $(el),
target = el.hash,
$target = $(target);
// check if the target has an offset, if its NOT undefined then run the code to allow things to scroll