I have a modal that fadesIn and displays a video.
I'd like to click the modal's background color (which fills the screen 100%x100%) to close the modal. The problem is, the way I have it coded at the moment, if I click the video player controls, it closes the modal as well.
Fiddle here:
http://jsfiddle.net/PWGHH/
Thanks.
When the Button is clicked, the HTML DIV is referenced using jQuery and its modal function is called along with properties data-backdrop: "static" and data-keyboard: false which disables the closing of the Bootstrap Modal Popup when clicked outside.
You have two options to close this modal: Click on the "x" or click anywhere outside of the modal!
Modals are built with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead. Clicking on the modal “backdrop” will automatically close the modal.
Try this:
$('#commercial1').click(function(event) {
event.stopPropagation();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With