jquery - Div not closing when clicked outside the div? -
Why not div div / hiding when clicked outside the div When I click outside div I div / close I'm using the following javascript to do the following.
$ (document) .mouseup (function (e) {var container = new array (); container. Push ($ ('$ openModal')) $. (Container, function Key, value) {if (! $) (Value!) (E.target) // If the target of the click is not a container ... and ($ value) .has (e.target) .length === 0) // ... nor a descendant of the container {$ (value) .hide ();}}};}); I want to close the markup of the divis.
& lt; div id = "openmodal" class = "modalDialog" & gt; & Lt; Div & gt; & Lt; a href = "# close" heading = "off" square = "off" & gt; X & lt; / A & gt; & Lt; Iframe src = "// player.vimeo.com/video/84419229?autoplay=0" width = "854" height = "480" frameborder = "0" webkitolopholoscreen mozillaofflosscreen acceptable slidescreen & gt; & Lt; / Iframe & gt; & Lt; / Div & gt; & Lt; / Div & gt;
use it
$ ("body "). children (). No ("#OpenModal") ("Click", function () {$ ("# openModal"). Hide ();}); edit $ (document) .ready (function () {$ ("body"). ) ("# OpenModal") ("click", function () {if (! $ ('$ OpenModal'). (': View')) $ ("# openModal"). Hide ();} );}); However, you already have a code, which is $ code ($) .ready () section in your code. You can put it in there too
Comments
Post a Comment