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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:28:49+00:00 2026-06-16T14:28:49+00:00

I have a hidden div, and upon clicking a link, it shows the div.

  • 0

I have a hidden div, and upon clicking a link, it shows the div.

  <div id="baystar">
        <!-- My hidden stuff -->
  </div>

  <div class="galactica">
    <li class="menu-563"><a class="menu-563 active" href="#">Tools</a></li>
  </div>

When you click the Tools link, div.baystar shows. When you click inside of div.baystar while open, it doesn’t close. When you click anywhere outside of div.baystar, div.baystar closes. All is working well. The problem is that when I click the Tools link to close div.baystar, it closes fast, then reopens, so it fires twice.

  $(".menu-563").click(function(){
    $("#baystar").slideToggle("fast");
    $(this).toggleClass("active"); return false;
  });

 $('a.menu-563').attr('href', '#'); {
 }

 var mouse_is_inside = false;

$(document).ready(function()
{
    $('#baystar').hover(function(){ 
        mouse_is_inside=true; 
    }, function(){ 
        mouse_is_inside=false; 
    });

    $("body").mouseup(function(){ 
        if(! mouse_is_inside) $('#baystar').hide();
    });
});

It works fine if I take out the mouse hover functions. Do I need some sort of delay, or does my code just need rewriting?

  • 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-16T14:28:50+00:00Added an answer on June 16, 2026 at 2:28 pm

    This happens because you only stop the click event from bubbling..

    You need to also stop the mouseup so that it does not reach body

      $(".menu-563").click(function(){
        $("#baystar").slideToggle("fast");
        $(this).toggleClass("active"); return false;
      }).mouseup(function(e){return false;});
    

    You could do this instead to handle the whole thing..

    $(".menu-563").click(function(e) {
        $("#baystar").slideToggle("fast");
        $(this).toggleClass("active");
        return false;
    });
    
    $('body').click(function(e){
        if (!$(e.target).closest('#baystar').length){
           $("#baystar").hide();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that has a gif animation in a hidden div. Upon
I have a hidden div (#contactArea) above another div. When I click the link,
Right now I have a link that causes a hidden div to appear when
I have a link that needs to show a hidden Div on click. For
I want to show hidden div on hover of <div class=thumb> and i have
I have a hidden div which I reveal with the jquery fadein() method: $(#panel).fadeIn(slow);
Continuing adopting my code to work with IE... I have a hidden div containing
I have an animation on a partially hidden div container that will execute when
I have a bunch of images that are in a hidden div. The div
I am having jQuery animation issues... I have a footer with a hidden div

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.