I need the exact functionality what jQuery light box does. In my project in a loop, I have a hidden element for every item. When a visitor will click on the element, he/she will see the hidden element. Then, when the visitor will click outside the element (new), the element will hide again. But, the element has an anchor tag. So, if the visitor will click on the element, he/she can go to the link. I have to find out how I can select the area which is outside of the element.
I am giving here a simple HTML.
<div style="width:500px; height: 500px; background: #000;" id="one">
</div>
<div rel="maisha" style="width:500px; height: 500px; background: #ff0; display: none;" id="two">
<a href="http://www.webdeveloperszone.com"> WDZ </a>
</div>
Javascript:
<script>
$("#one").click(function(){
$("#one").hide();
$("#two").show();
});
</script>
Now I need the code by I can implement: "When a visitor clicks outside of id="two"
, it will show div id="one"
again and div id="two"
will hide. But, if he/she clicks inside div id="two"
, it has another functions.