The below function brings in a slide-in banner when the user has scrolled past the element with the ID of #last
.
The banner has a .close
button. But once the banner was closed and the user navigates away and back the banner shows up again.
How do I modify the code so the browser remembers the banner was closed and not show it again? (until the cookies are cleared)
Thanks.
The banner is implemented as shown below on this website: bps-world.com
$(function() {
$(window).scroll(function(){
var distanceTop = $('#last').offset().top - $(window).height();
if ($(window).scrollTop() > distanceTop)
$('#slidebox').animate({'right':'0px'},300);
else
$('#slidebox').stop(true).animate({'right':'-430px'},100);
});
$('#slidebox .close').bind('click',function(){
$(this).parent().remove();
});
});