Skip to content

Instantly share code, notes, and snippets.

@mindprint
Last active December 3, 2018 10:18
Show Gist options
  • Save mindprint/5db6e444b663857315246fc00d0ca5ea to your computer and use it in GitHub Desktop.
Save mindprint/5db6e444b663857315246fc00d0ca5ea to your computer and use it in GitHub Desktop.
Unbounce - Smooth scroll to anchor
<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