jeudi 14 juillet 2016

Stopping the scrolling animation once it has been closed

I have a newsletter section that appears on the site when the person starts to scroll down after a certain point. On this newsletter section there is a close button that allows this Newsletter section to be closed. However the problem is that when they close the newsletter and start scrolling again it reappears. So the first function is cancelling out the second. How can the close button remove the newsletter button from the page and not reappear when they start to scroll again?

var amountScrolled = 300;

$(window).scroll(function() {
    if ( $(window).scrollTop() > amountScrolled ) {
        $('.Newsletter_btn').fadeIn('slow');
    } else {
        $('.Newsletter_btn').fadeOut('slow');
    }
});

$(document).ready(function(c) {
    $('.alert-close').on('click', function(c){
        $(this).parent().fadeOut('slow', function(c){ });
    });
});
×

Aucun commentaire:

Enregistrer un commentaire