tags:

views:

43

answers:

3

I have implented the show part properly. But how to implement the hide of popup on click of anything on the page? And moreover there is a link, on click of which this will expand and collapse also.

Any help. Thanks.

+1  A: 
  1. Attach an event hanlder to the popup element. On click of that stop event bubbling.

  2. Attach an event handler to document. On click of that hide the popup.

A sample using jQuery

Updated sample

rahul
i have updated the question a little bit....your thing do not in that scenario...can u plz give a modified code?
Subrat
see my updated answer.
rahul
A: 

why don't you try this.

function close() {
   document.getElementById("popupBox").style.display="none";
}

Onlick call the above function. For expand and collapse Mootools provides very simple implementation check it.

Webbisshh
A: 

function switchElement(elementId) {
   if(document.getElementById(elementId).style.display=="")
   {
   document.getElementById(elementId).style.display="none";
   }
   else
   {
   document.getElementById(elementId).style.display="";
   }
}

expand added to Webbisshh's code.

Luuk van Rens