Created
March 31, 2017 05:58
-
-
Save MikSDigital/1a8f41a621e4e53e5abd066273e9af55 to your computer and use it in GitHub Desktop.
scrollTo.js scrolling on Click
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> | |
| $(document).ready(function () { | |
| var formErrors = ''; | |
| if(formErrors) { | |
| scrollToTitle(); | |
| } | |
| $('#downloadBook').on('click', function (e) { | |
| e.preventDefault(); | |
| scrollToTitle(180); | |
| }) | |
| function scrollToTitle(distance) { | |
| distance = distance || 0; | |
| $('body,html,document').animate({ | |
| scrollTop: $(".registration-form").offset().top - distance | |
| }, 750); | |
| } | |
| }) | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment