popup contains whole page - html

I have a small problem in my website
I added a new popup but somehow it doesnt work properly I used this link
http://www.sevensignature.com/blog/code/pure-css-popup-without-javascript/
and on my website it floats over content and other content is still visible somehow, please have a look at www.kareem-helal.com/metin and press on Inregistrare and see what happens
you can check the code by view page source or here's a small part
<li><a id="a2" href="#popup1">ÎNREGISTRARE</a></li>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thanks for pop me out of that button, but now I'm done so you can close this window.
</div>
</div>
</div>
and CSS
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
I don't really know the problem can anybody help?

add z-index to .overlay class
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
z-index:9999;/*Add this property*/
}
replace your html like
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="">
Thanks for pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>

Related

my button pop-up keeps pushing the page to top when i close it

Hi I'm trying to make a simple text pop-up button using just html and CSS. I looked at a bunch of examples but most of them use JavaScript in some way so I cant use them. found some that is pure CSS but when I tried them, they all do this weird thing where closing the pop-up brings me to top of page. Any help is appreciated. Thanks
jsfiddle: http://jsfiddle.net/hjrudc5n/
This is my HTML
```
<div class="box"><a class="button" href="#popup1">Show Overlay</a></div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<a class="close" href="#">×</a>
<div class="content">Content</div>
</div>
</div>
</div>
and this is my CSS
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
Check this out:
http://jsfiddle.net/aj43psdw/13/
The problem with your code was that using "#" as an href will always take you to the top of the page, no matter what. Also, makes thing hard to control.
What you can do. is work with labels and checkboxes, and control the "state" of things via that.
Like this:
[name="popup"]{
width:0;
height:0;
overflow:hidden;
position:relative;
z-index:-1;
pointer-events:none;
}
[name="popup"]:checked ~ .overlay{
visibility: visible;
opacity: 1;
}
In the fiddle I linked you, clicking the button will check the checkbox, that we'll show via css. the X button will do the same, unchecking it.
It was because of href="#" of the anchor tag you were using, which led to going to top of page on closing the popup.
A workaround is to use <input type="checkbox" /> (so that you can use :checked selector) along with <label>(so that you can still interact with checkbox after hiding it), to hide, and unhide the popup.
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
#pop:checked + .overlay {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#pop{
display: none; /*Hide the checkbox*/
}
<div class="box"><label class="button" for="pop">Show Overlay</label></div>
<input type="checkbox" id="pop" />
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<label class="close" for="pop">×</label>
<div class="content">Content</div>
</div>
</div>

Why is the width of my CSS animation dependent on previous HTML or CSS features?

So I'm trying to have an underline that goes the width of each text. E.g. I have headers "Team" and "Schedule", and I want the underline to go the full length of each word despite them being different lengths. This is my current code (I've included most all of the code):
html,
body {
margin: 0;
}
.menu {
position: relative;
transition: 0.3s;
z-index: 2;
}
.change .menu {
background-color: white;
width: 60vh;
height: 100vh;
color: black;
position: absolute;
top: -10px;
left: -30px;
z-index: 2;
box-shadow: 0px 8px 16px 0px;
}
.header {
position: fixed;
font-size: 20px;
top: 8px;
left: 16px;
font-family: 'Bebas Neue', cursive;
text-align: left;
color: black;
padding: 10px;
}
.change .content {
position: relative;
}
.menu a {
opacity: 0%;
}
.change .menu a {
opacity: 100%;
color: black;
text-decoration: none;
display: block;
position: relative;
left: 100px;
bottom: -50px;
font-size: 30px;
font-family: 'Bebas Neue', cursive;
z-index: 2;
}
.content h3 {
opacity: 0%;
}
.underbar {
position: relative;
}
.underbar:after {
content: '';
position: absolute;
width: 0;
height: 3px;
display: block;
margin-top: 0px;
right: 0;
background: #24478f;
transition: width .5s ease;
-webkit-transition: width .5s ease;
}
. .underbar:hover:after {
width: 12%;
left: 0;
background: #24478f;
}
.sub_underbar {
position: relative;
}
.sub_underbar:after {
content: '';
position: absolute;
width: 0;
height: 3px;
display: block;
margin-top: 5px;
right: 0;
background: #ffcc00;
transition: width .5s ease;
-webkit-transition: width .5s ease;
}
.sub_underbar:hover:after {
width: 38% left: 0;
background: #ffcc00;
}
<div class="container">
<img src="team_sunset.JPG" alt="Team Picture" style="width:100%;">
<div class="centered" style="font-size:20vw;">UMWSC</div>
<div class="header" onclick="myFunction(this)">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
<div class="menu" id="menu_scroll">
<div class="content">
HOME
<h3 class="sub_underbar">MISSION STATEMENT</h3>
<h3 class="sub_underbar">CONTACT US</h3>
TEAM
<h3 class="sub_underbar">ROSTER</h3>
<h3 class="sub_underbar">LEADERSHIP</h3>
<h3 class="sub_underbar">SCHEDULE</h3>
<h3 class="sub_underbar">STATS</h3>
NEWS
<h3 class="sub_underbar">GALLERY</h3>
<h3 class="sub_underbar">BLOG</h3>
GET INVOLVED
<h3 class="sub_underbar">MERCH</h3>
<h3 class="sub_underbar">DONATE</h3>
<h3 class="sub_underbar">PARTNER WITH US</h3>
<h3 class="sub_underbar">WORK WITH US</h3>
MORE INFO
<h3 class="sub_underbar">FORMS</h3>
<h3 class="sub_underbar">FAQS</h3>
</div>
</div>
<div id="scroll_header">
<h4>UMWSC</h4>
</div>
</div>
</div>
I think currently the width is dependent on some parent feature because when you hover to the right of the text, there's a specific spot that "triggers" the animation of the underline to occur.
I'm sure there's a lot wrong with my previous code that might be causing this current issue. Any help would be greatly appreciated! Thank you.
EDIT: The picture shows how the underline goes past the width I want it to go, I just want it to be the length of the word 'HOME'. drop-down content picture
If I'm understanding this correctly you want the main menu titles underline to span across the biggest item in that group of items. If so try this:
a {
text-decoration: none;
}
.menu {
position: relative;
transition: 0.3s;
z-index: 2;
}
.change.menu {
background-color: white;
width: 60vh;
height: 100vh;
color: black;
position: absolute;
top: -10px;
left: -30px;
z-index: 2;
box-shadow: 0px 8px 16px 0px;
}
.header {
position: fixed;
font-size: 20px;
top: 8px;
left: 16px;
font-family: 'Bebas Neue', cursive;
text-align: left;
color: black;
padding: 10px;
}
.change.content {
position: relative;
}
.underbar {
position: relative;
}
.underbar:after {
content: '';
position: absolute;
width: 0;
height: 3px;
display: block;
margin-top: 0px;
right: 0;
background: #24478f;
transition: width .5s ease;
-webkit-transition: width .5s ease;
}
.underbar:hover:after {
width: 100%;
left: 0;
background: #24478f;
}
.sub_underbar {
position: relative;
}
.sub_underbar:after {
content: '';
position: absolute;
width: 0;
height: 3px;
display: block;
margin-top: 5px;
right: 0;
background: #ffcc00;
transition: 100% .5s ease;
-webkit-transition: 100% .5s ease;
}
.sub_underbar:hover:after {
width: 38% left: 0;
background: #ffcc00;
}
<div class="container">
<div class="header" onclick="myFunction(this)">
<div class="menu" id="menu_scroll">
<div class="content-holder">
<div class="content">
HOME
<h3 class="sub_underbar">MISSION STATEMENT</h3>
<h3 class="sub_underbar">CONTACT US</h3>
</div>
<div class="content">
TEAM
<h3 class="sub_underbar">ROSTER</h3>
<h3 class="sub_underbar">LEADERSHIP</h3>
<h3 class="sub_underbar">SCHEDULE</h3>
<h3 class="sub_underbar">STATS</h3>
</div>
<div class="content">
NEWS
<h3 class="sub_underbar">GALLERY</h3>
<h3 class="sub_underbar">BLOG</h3>
</div>
<div class="content">
GET INVOLVED
<h3 class="sub_underbar">MERCH</h3>
<h3 class="sub_underbar">DONATE</h3>
<h3 class="sub_underbar">PARTNER WITH US</h3>
<h3 class="sub_underbar">WORK WITH US</h3>
</div>
<div class="content">
MORE INFO
<h3 class="sub_underbar">FORMS</h3>
<h3 class="sub_underbar">FAQS</h3>
</div>
</div>
</div>
<div id="scroll_header">
<h4>UMWSC</h4>
</div>
</div>
</div>

Why is my popup window not appearing above all other html elements?

.box {
width: 40%;
margin: 0 auto;
padding: 35px;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
display: inline-block;
}
.button {
font-size: 1em;
padding: 10px;
color: #222;
border: 2px solid #06D85F;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: #06D85F;
}
.overlay {
position: fixed;
top: 100px;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 40%;
position: relative;
transition: all 5s ease-in-out;
z-index: 999 !important;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
This is my css on a button which will trigger a popup window. However, some of the elements under(supposed to be) the popup showed up and covered the text on the popup window. I have already tried to set the z-index to 99999 but it doesn't work at all. Any idea?
Below is the html code as suggested
<div class="box">
<a class="button" href="#popup1">News</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Upcoming event</h2>
<a class="close" href="#">×</a>
<div class="content">
Christmas is coming! The first ever Christmas tour to Australia is coming soon. We are looking forward to see you.
</div>
</div>
</div>
Edited:
I guess I need to provide more to explain. The input field below and the iframe element will covered my pop up window, not just simply appear behind the popup due to the transparent property. The background will be in a little of gray after the popup triggered, but the element will be shown in background color of white which the default color of my webpage. And the below element showed up without being covered....
<div class="container">
<div class="row">
<div class="col-lg-6">
Youtube Playlist
</div><!-- /.col-lg-6 -->
<div class="col-lg-6">
Youtube Single Video
</div>
</div>
<form class="form-horizontal" method="POST">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon"><button title="Click to Show/Hide Content" type="button" onclick="if(document.getElementById('yttt') .style.display=='none') {document.getElementById('yttt') .style.display=''}else{document.getElementById('yttt') .style.display='none'}">Show/Hide</button></span>
<input type="text" class="form-control" id="ytlistbox"><span class="input-group-btn"><button class="btn btn-default" id="listclick">Preview</button></span>
<span class="input-group-btn"><button class="btn btn-default" id="singleclick">Confirm</button></span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="input-group">
<span class="input-group-addon"><button title="Click to Show/Hide Content" type="button" onclick="if(document.getElementById('ytt') .style.display=='none') {document.getElementById('ytt') .style.display=''}else{document.getElementById('ytt') .style.display='none'}">Show/Hide</button></span>
<input type="text" class="form-control" id="ytsinglebox"><span class="input-group-btn"><button class="btn btn-default" id="singleclick">Preview</button></span>
<span class="input-group-btn"><button class="btn btn-default" id="singleclick">Confrim</button></span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div>
</form>
<br />
<?php
$query2 = mysql_query("SELECT listurl, singleurl FROM tbluser WHERE user_Id = '$userid'");
$row2 = mysql_fetch_assoc($query4);
?>
<div id="yttt" class="col-lg-6" style="display: ;">
<iframe id="ytlist" src="https://www.youtube.com/embed/videoseries?list=<?php echo $row2['$listurl']?>&autoplay=1&loop=1" name="ytlist" width="550" height="400" frameborder="0" allowfullscreen></iframe>
</div>
<div id="ytt" class="col-lg-6" style="display: ;">
<iframe id="ytsingle" src="" name="ytsingle" width="550" height="400" frameborder="0" allowfullscreen></iframe>
</div>
</div>
I know quite a few of the advantage for using mysqli, strip_tag() and real_escape_string() function for security purpose. Please don't mention them again.
add top property 0
.overlay{
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
z-index:999;
}
May be you should give z-index to .overlay
.overlay{
position: fixed;
top: 100px;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
z-index:999;
}
or
This is happening because you have used semi transparent background-color for .overlay
background: rgba(0, 0, 0, 0.7);
If you don't want to show background element then use solid color #000 or #888 etc.
.box {
width: 40%;
margin: 0 auto;
padding: 35px;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
display: inline-block;
}
.button {
font-size: 1em;
padding: 10px;
color: #222;
border: 2px solid #06D85F;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: #06D85F;
}
.overlay {
position: fixed;
top: 100px;
bottom: 0;
left: 0;
right: 0;
background: #888;
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 40%;
position: relative;
transition: all 5s ease-in-out;
z-index: 999 !important;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px) {
.box {
width: 70%;
}
.popup {
width: 70%;
}
}
<div class="box">
<a class="button" href="#popup1">News</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Upcoming event</h2>
<a class="close" href="#">×</a>
<div class="content">
Christmas is coming! The first ever Christmas tour to Australia is coming soon. We are looking forward to see you.
</div>
</div>
</div>
<h1><center>User profile</center></h1>
You need z-index to control divs/elements layers position.
FYI: z-index needs position property to work, like relative, absolute, fixed...

Using pure HTML and CSS in modal

I found this modal http://codepen.io/imprakash/pen/GgNMXO pure html and css no js. It's all great and all but how can I make it trigger without using a button or link? I want it to pop up to welcome visitors once the website load.
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
i modified your codepen
body {
font-family: Arial, sans-serif;
background: url(http://www.shukatsu-note.com/wp-content/uploads/2014/12/computer-564136_1280.jpg) no-repeat;
background-size: cover;
height: 100vh;
}
h1 {
text-align: center;
font-family: Tahoma, Arial, sans-serif;
color: #06D85F;
margin: 80px 0;
}
.box {
width: 40%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid #06D85F;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: #06D85F;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:not(:target) {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
<h1>Popup/Modal Windows without JavaScript</h1>
<div class="box">
<a class="button" href="#popup1">Let me Pop up</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#popup1">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>
You could make it with animations. A quick example:
#popup1 {
animation-name: welcome;
animation-duration: 2s;
}
#keyframes welcome {
0% {
opacity: 0;
}
30% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div id="popup1" class="overlay">Hey!</div>
As the technique uses :target psuedo class, you can directly target with appending the id of that pop up element.
Try this, http://codepen.io/imprakash/pen/GgNMXO#popup1
Just appended #popup1 to target. Thus as soon as you open, popup will be targeted and opened.

Can I make the activation of a popup <div> do something to another <div>?

I have a link that will show a popup once clicked.
<a class="button" href="#popup1"><span id="contactspan"></span></a>
When the link is clicked an overlay shows up together with a popup .
DIV
<div id="popup1" class="overlay">
<div class="popup">
<h2>Contact</h2>
<a class="close" href="#">×</a>
<div class="content">
Stuff in popup.
</div>
</div>
</div>
CSS
.box {
width: 50%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
transition: all 0.3s ease-out;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 50%;
height: 50%;
position: relative;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .content {
max-height: 100%;
overflow: auto;
}
My problem is that when the popup is visible, I can still click through the overlay and hit other links in my div container.
Is there a way to set "pointer-events: none;" to be applied to div id="container" as long as my popup is visible?
This is called event bubbling, see
What is event bubbling and capturing?
You need to use:
e.stopPropagation();
In your JavaScript at the top of your event handler.