Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Scroll to form on button click and focus on first input
- $('#up-to-form').on('click', function(e) {
- e.preventDefault();
- $('html, body').animate({
- scrollTop: $('.form-container').offset().top - 20
- }, 'slow');
- $('.form-container form input').first().focus();
- });
- //Make form fixed so it stays in view on desktop viewport
- $(window).scroll(function() {
- var scroll = $(window).scrollTop();
- if (scroll >= 50) {
- $(".form-fixed-wrapper").addClass("fixed-scroll");
- }
- if (scroll <= 50) {
- $(".form-fixed-wrapper").removeClass("fixed-scroll");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement