Reputation: 5761
The following code allows me to close an overlay when I click on the #boxclose_4, however I would like to be able to click outside the overlay to close it as well.
$('#boxclose_4').click(function(){
box_4.animate({'top':'-400px'},500,function(){
overlay2.fadeOut(1000);
});
});
If I add body ('#boxclose_4, body') as soon as box_4 comes down the overlay disappears and appears quickly.
Any help? Thanks
Upvotes: 0
Views: 51
Reputation: 731
You want to add the .overlay
as an event, not body
$('#boxclose_4, .overlay').click(function(){
box_4.animate({'top':'-400px'},500,function(){
overlay2.fadeOut(1000);
});
});
Upvotes: 1