Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 901109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:30:14+00:00 2026-05-15T15:30:14+00:00

My problem: For example: I have a link, when I click on it a

  • 0

My problem: For example: I have a link, when I click on it a popup div is shown, and when I click on the link again then closes the popup, that’s ok, but how can I do to close the opened popup box when I click anywhere else outside of the popup.

I’ve searched a lot and I found some solutions, but those weren’t enough good to me, as I know there is a way to hide the box by offset X, and offset Y, as I understood works in this way, the javascript tracks the position of the popup and if the users clicks on an other position it closes or what..

Please could someone tell me how can I do it this way? It’s really important for me!!

Please if you don’t understand something, or do you have any questions write here and I will try to explain it better!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:30:14+00:00Added an answer on May 15, 2026 at 3:30 pm

    Csirkepöcsű? 🙂

    You need an onclick handler for the document, or the body.

    ​See it in action.

    // make sure that click on the popup does nothing
    document.getElementById("pop").onclick = function(e) {
      // in all browsers
      if(e && e.stopPropagation) {
        e.stopPropagation();
      } else {
        e = window.event;
        e.cancelBubble = true;
      }
    };
    
    // click anywhere else
    document.documentElement.onclick = function() {
      // will hide the popup
      document.getElementById("pop").style.display = "none";
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is that I receive for example a date in a concatenated format:
Has anyone seen this type of IE display problem? Example http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg Note that it
i have problem use link_to_remote link_to_remote document example say link_to_remote Delete this post, :update
On my index.html file, I have a link to a script: <div id=myList> <div
I have a problem that has been consuming me for days. I have a
I will show the problem with a example. There is some text in the
I will explain problem with an example: There is two table in my database,
Here's a perfect example of the problem: Classifier gem breaks Rails . ** Original
I am thinking about a DB Design Problem. For example, I am designing this
I'm not sure how to describe this problem, so I think an example is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.