Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const stickySignup = () => {
- const form = $('.signup-form');
- const form_position = form.offset().top;
- const form_height = form.height();
- $(window).scroll(function(e) {
- if(!form.is('.sticky') && $(this).scrollTop() > form_position + form_height) {
- form.addClass('sticky');
- }
- else if(form.is('.sticky') && $(this).scrollTop() <= form_position + form_height) {
- form.removeClass('sticky');
- }
- });
- };
- export default stickySignup;
Add Comment
Please, Sign In to add comment