Search code examples
jqueryfadeinfadefadeout

How can I stop a second touch in the delay from firing?


I've got this jquery -

(function(){

jQuery(window).bind('touchstart', function(){
    $('#email-info').fadeOut('2400', function() {
    });  
});

jQuery(window).bind('touchend', function(){
    $('#email-info').delay('2800').fadeIn('2400', function() {
    });    
});

})();  

Which works great, but if I touch my phone when it's in the 'delay' it'll fadein/out quickly again.

Is there a way to stop this ?


Solution

  • jQuery(window).bind('touchend', function(){
        $('#email-info').delay('2800').stop(false,false).fadeIn('2400', function() {
        });