How do you make the popup appear ?
If you do this when clicking another DOM element... do this:

let's say the trigger has an ID "trigger"... and the popup div, ID
"popup".

$(function(){
    $('#trigger').click(function( event ){
          $('#popup').show();
           event.stopPropagation();
    });
    $(document).click(function(){
          $('#popup').hide();
     });
});

OR

$(function(){
      $(document).click(function( event ){
          if( event.target.id == 'trigger' ){
               $('#popup').show();
          }else{
               $('#popup').hide();
          }
     });
});

if the trigger is a link (A) and you don't want the link or # to be
followed, add "event.preventDefault();" under "$('#popup').show();" in
any of both cases.
I Hope that helps.


On Sep 12, 9:58 am, Wizzud <[EMAIL PROTECTED]> wrote:
> You could try something like this...
>
> $('#myTrigger').click(function(){
>   $('#myDiv').show();
>   $(document).one('click', function(){ $('#myDiv').hide(); return false; });
>   return false;
>
>
>
>
>
> });
> james_027-2 wrote:
>
> > Hi,
>
> > I am trying to make a simple <div> that will pop which will be close
> > by just clicking to any part of the page. I have no idea of how to do
> > this. I have try something like this
>
> > $(document).click(function(e){
> >     $('[EMAIL PROTECTED]').hide();
> > });
>
> > $(body).click(function(e){
> >     $('[EMAIL PROTECTED]').hide();
> > });
>
> > but all my other click function on specific html tag won't work
> > anymore, it seems to be overide.
>
> > Thanks
> > james
>
> --
> View this message in 
> context:http://www.nabble.com/popup-%3Cdiv%3E-tf4420012s15494.html#a12634939
> Sent from the JQuery mailing list archive at Nabble.com.- Hide quoted text -
>
> - Show quoted text -

Reply via email to