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

  • Home
  • SEARCH
  • 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 9209461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:50:54+00:00 2026-06-18T00:50:54+00:00

I have a little test I’m doing with clicking on a image that reveals

  • 0

I have a little test I’m doing with clicking on a image that reveals an iframe. Then I want to click anywhere but that image (the #container div). I can get the iframe to popup but I can’t get it to hide when I click in the main div (#container).

   <html>
   <head>
   <script type="text/javascript"    src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
   <script>
$(function() {
  var moveLeft = 20;
  var moveDown = 10;

  $('a#trigger').click(function(e) {
    $('div#pop-up').show();
      //.css('top', e.pageY + moveDown)
      //.css('left', e.pageX + moveLeft)
      //.appendTo('body');
  }, function() {
    $('#container').click(function(){
    $('div#pop-up').hide();
    });

  $('a#trigger').mousemove(function(e) {
    $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
  });

   });</script>
       <style>
    h1{
    margin: 0;
    padding: 0;
    font-weight: normal;
    }
    div#container {
    width: 580px;
    margin: 15px auto 0 auto;
    padding: 20px;
    background: #000;
    border: 1px solid #1a1a1a;
    }
   /* HOVER STYLES */
   div#pop-up {
   display: none;
   position: absolute;
   /*width: 150px;
   padding: 150px;*/
   background: #eeeeee;
   color: #000000;
   border: 1px solid #1a1a1a;
   font-size: 90%;
  }
    </style>

   </head>
   <body>
<div id="container">
    <h1>Pop-out Example - pop out div on hover</h1>
    <p>
        <a href = "#" id="trigger"><img src="router.png"/></a>
    </p>
</div>
<div id="pop-up">
    <p>
        <iframe width="500px" height="350px" align= "top-left" src="http://127.0.0.1:667"></iframe>
    </p>
</div>
    </body>
    </html>
  • 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-06-18T00:50:55+00:00Added an answer on June 18, 2026 at 12:50 am

    Seeing as you are using jQuery you can do the following. The javascript instructs that if the document is clicked anywhere the target div is hidden. However if the click was within the boundaries of the element target the hide() is stopped by stopPropagation()

    Javascript

    $(document).click(function() {
        $('#target').hide();
    });
    $("#target").click(function(e) {
        e.stopPropagation();
    });
    

    HTML

    <div id="target">Test</div>
    

    CSS

    #target {
      width: 50px;
      height: 50px;
      background-color: red;
    }
    

    Illustrated in this fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little test project set up so that when you click a
I have a little JUnit-Test that export an Object to the FileSystem. In the
I have a little foundation tool test (Objective-C) that I am playing with and
I have a little test.sh script that I run from the command line ./test.sh
I have setup a little test project that I hope will explain my problem.
Both ideone.com and codepad.org have Little-Endian architechtures. I want to test my code on
Please excuse the simplicity and length of this, but I have a little test
This here is a little test class that I have. Problem is that it
In this little test app, I have a ModalViewController that pops up over View
I have created a little test project to try to resolve a problem I

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.