Note that there are some explanatory texts on larger screens.

plurals
  1. POPopup background doesn't hide when closing
    primarykey
    data
    text
    <p>I created a popup and then moved it over to the final domain. Now the background overlay (<code>#overlay-back</code>) doesn't hide when closing via the 'X' (<code>.close-image</code>) in the corner, yet it does when pressing ESC. Something I've missed?</p> <p>Here's the live site: <a href="http://www.nominee-services.co.uk/" rel="nofollow">http://www.nominee-services.co.uk/</a></p> <p><strong>JS :</strong></p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function () { $('#overlay-back').fadeIn(800, function () { $('#popup').show(); }); $(".close-image").on('click', function () { $('#popup').hide() }); }); $(".close-image").on('click', function () { $('#overlay-back').hide(); }); $(document).on('keydown', function (e) { if (e.keyCode === 27) { // ESC $('#popup').hide(); } }); $(document).on('keydown', function (e) { if (e.keyCode === 27) { // ESC $('#overlay-back').hide(); } }); $(document).on('click', function (e) { if ($(e.target).closest('#popup').length === 0) { $('#overlay-back').hide(); } }); $(document).on('click', function (e) { if ($(e.target).closest('#popup').length === 0) { $('#popup').hide(); } }); &lt;/script&gt; </code></pre> <p><strong>CSS :</strong></p> <pre><code>#popup { position: absolute; display: hidden; top: 50%; left: 50%; width: 960px; height: 98px; margin-top: -194px; margin-left: -480px; background-color: #fff; z-index: 20; padding: 5px; } #overlay-back { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0.7; filter: alpha(opacity=60); z-index: 19; display: none; } .close-image { display: block; float: right; cursor: pointer; z-index: 21; position: absolute; right: 8px; top: 8px; } </code></pre> <p><strong>HTML :</strong></p> <pre><code>&lt;div id="overlay-back"&gt;&lt;/div&gt; &lt;div id="popup"&gt; &lt;img class="close-image" src="images/closebtn.png" /&gt;&lt;span&gt;&lt;img src="images/load_sign.png" width="960" height="398" /&gt;&lt;/span&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload