Created
April 9, 2017 23:27
-
-
Save Peppershaker/57c475c987427b13971e3d784908d999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.ready(){ | |
// Smooth Scroll for home page | |
var buttons = ["#topbtn", "#whyusbtn"]; | |
var anchors = ["header", ".propellingAnchor"]; | |
for (let i = 0; i<anchors.length; i++) { | |
document.querySelector(buttons[i]).addEventListener('click', function(e){ | |
e.preventDefault(); | |
document.querySelector(anchors[i]).scrollIntoView({ | |
behavior: "smooth" | |
}) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment