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 6944817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:21:24+00:00 2026-05-27T13:21:24+00:00

I have used the following code to get click outside to close working: Here

  • 0

I have used the following code to get “click outside” to close working:

Here is the jsfiddle of the entire code (please enable jQuery on the left navigation for it to work):

http://jsfiddle.net/jhacks/ZxBXe/17/

On click the divs show:

$('div.topIconNew').click(
    function(){
        $(this).siblings('div.topTip').show();
        $(this).siblings('div.topDrop').slideDown(240);  

On click outside the divs hide:

$(document).click(
    function(event){
        $('div.topTip, div.topDrop').hide();
    }
);
$('div.topTip, div.topDrop').click(
    function(event){
        event.stopPropagation();
    }
);

The problem with that above is that if I add topIconNew .stopPropagation, then once the topTip and topDrop divs are open, they won’t close if I click that same topIconNew again (i.e. toggle) or another instance of topIconNew.

My attempted solution is the following:

if($('div.topTip, div.topDrop').is(':visible')){
        $('div.topIconNew').click(
            function(){
                 // need to specify only divs currently open to hide
                $('div.topTip, div.topDrop').hide();
            }
        )
    }
    else {
        $('div.topIconNew').click(
            function(event){
                event.stopPropagation();    
            }
        );
    }   

I want the above to say to hide topTip and topDrop upon clicking topIconNew only if the topTip and topDrop are visible AND only hide the topTip and topDiv elements that are currently open. Additionally, if nothing is open (else statement), I want the topIconNew to stopPropagation… so that the div#wrapper.hide() doesn’t conflict with the topIconNew.show().

Currently, the else statement is working, as without it the topIconNew .show and .hide conflict with one another and they don’t work. But now they do…

However, the if statement is not working as the topTip and topDrop don’t close when they are open and I click topIconNew. Additionally, I know at least one problem I have is that I have not specified to close the topTip and topDrop that are currently open (right now I’m just telling it to close any of them).

Any and all help is greatly appreciate here. Thanks!!!

  • 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-27T13:21:24+00:00Added an answer on May 27, 2026 at 1:21 pm

    Well, there’s a problem in that you are never assigning the ‘hide’ code to the topIconNew.

    Is this a little closer to what you wanted?

    http://jsfiddle.net/ZxBXe/20/

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

Sidebar

Related Questions

i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
I have used following code to create a simple PDF file. It executes fine
I have used the following code in a number of applications to load .DLL
i have used the following code in .htaccess Options +FollowSymlinks RewriteEngine On RewriteBase /
I have the following code - it is used to load a drop down
I have used the code supplied in the following CodeProject article in the past
I have the following code in an Autofac Module that is used in my
I have used the following code to generate some dynamic checkboxes. This works for
I have used the following code to open the current page URL in Rich
i have the following code used to serialize a label's content. When i press

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.