简体   繁体   中英

How to CLOSE not HIDE a div on click using jquery?

I have a modal window with an embeded video, this video plays but then once the mask (outer window) is clicked, the sound etc is still playing in the background.

This is the code:

//if mask is clicked
$('#mask').click(function () {
    $(this).hide();
    $('.window').hide();
});

I need the window to close not hide. I tried, .remove which works but then once another video is clicked the div has been removed completely and won't play.

HELP !

EDIT- I am using this jquery modal window:

http://www.queness.com/resources/html/modal/jquery-modal-window.html

Then im adding a iframe provided by the client to the "dialog".

$('.window').remove() is the only way to get rid of a div completely.

If you need the div again you'll have to recreate it, but that's not too difficult.

Or you could remove all the div's content with $('.window').html ('');

(edited to take account of something in the question I missed at first glance)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM