Last active
December 3, 2018 10:18
-
-
Save mindprint/5db6e444b663857315246fc00d0ca5ea to your computer and use it in GitHub Desktop.
Unbounce - Smooth scroll to anchor
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
<script> | |
lp.jQuery(function($) { | |
// The speed of the scroll in milliseconds | |
var speed = 1000; | |
// Find links that are #anchors and scroll to them | |
$('a[href^=#]') | |
.not('.lp-pom-form .lp-pom-button') | |
.unbind('click.smoothScroll') | |
.bind('click.smoothScroll', function(event) { | |
event.preventDefault(); | |
$('html, body').animate({ scrollTop: $( $(this).attr('href') ).offset().top }, speed); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment