jQuery show div click to hide then do not show again

Posted by Jonny Wood on Stack Overflow See other posts from Stack Overflow or by Jonny Wood
Published on 2010-05-25T11:42:51Z Indexed on 2010/05/25 11:51 UTC
Read the original article Hit count: 388

Filed under:
|
|
|

I am using jQuery to hide a div on my page:

$(document).ready(function(){   
$('#message').hide();

When a certain part of the page scrolls into view the div shows using

$(window).scroll(function() {

            var top = 0;
            top = $(window).scrollTop();


            if((top >= 1000) && (top < 2000)){

                $('#message').fadeIn('slow');
            }    
            }

I want to add a close button to this as follows

$('a#message-hide').click(function() {
$('#message').hide('fast');
return false;

All good so far but the part I cannot figure out is how to then STOP the div re-appearing when the user scrolls back to the trigger position on the page...?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about show-hide