javascript - Click linked image to close / hide div -
It has so far to me. I have tried various solutions, but I am missing something: (
This is my html:
& gt; Lt; a class = "close-x" href = "#" & gt; & lt; img src = "x-close.png" alt = "x-close" width = "30" height = "30" /> < P> Here's my CSS: .container {width: 333px; display: block; position: fixed; top: 30%; left: 0;} .box {background: RGBA ( 255, 255, 255, 0.8);} a.close-x {position: absolute; top: -15px; right: -15 PX;} < Use other window load instead of document preparation event.
Here's how you can do it:
$ (function () {// short way to write document. $ $ ('DivContainer a.close-x'). Click (function (e) {e.preventDefault (); var div = $ (This) .next ('.box') .lideToggle ();});});
Comments
Post a Comment