I implemented a popup window on my website, and I utilized jQuery to make it fade in and out when specific areas are clicked. A notable feature is that if the user clicks on the background instead of the box itself, the application will close.
$("#fixedHoverBg").click(function(e){
if(e.target == this)
{
$("#fixedHoverBg").fadeOut("slow");
}
});
This functionality works as expected when clicking above or below the popup box's area, but not on its left or right side. It is peculiar because there is no surrounding container for the box, so there should be no other element interfering with the background click event.
Below is the structure of divs in my HTML:
<div id='fixedHoverBg'>
<center>
<div id='selectorWindow'>
<!-- Content goes here -->
</div>
</center>
CSS:
#fixedHoverBg {
position: fixed;
background - color: rgba(255, 255, 255, 0.85);
z - index: 200000;
width: 100 % ;
height: 100 % ;
top: 0;
left: 0;
display: none;
}
#selectorWindow {
width: 730px;
height: 600px;
background: radial - gradient(ellipseatcenter, rgba(87, 179, 237, 1) 0 100 % ;
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = '#57b3ed', endColorstr = '#328ee0', GradientType = 1);
margin - top: 90px;
border: 5px solid#ffae43;
box - shadow: 0 0 0 6px white,
0 0 20px 5px rgba(0, 0, 0, 0.4);
border - radius: 5px;
position: relative;
display: block;
}
I am unable to identify what is causing this unexpected behavior of the click event!