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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:52:00+00:00 2026-06-05T08:52:00+00:00

I have looked in the stackoverflow archives but could not find a solution. The

  • 0

I have looked in the stackoverflow archives but could not find a solution.

The problem is I have a button when mouse is over it, it shows a box beneath it. Now if the mouse moves out of the button the box should hide, but the tricky part comes here. If the mouse leaves the button but remains on the box the box should not hide.

I am using the mouseover and mouseout functions but as soon as the mouse moves out of the button the box hides, even if i try to place the mouse over the box.

(function($) { 
      $(function() {
            var dropDown = $('.box'),
            timer,
            cartButton = $('.button');

            cartButton.hover(function(){
                 dropDown.slideToggle();
            });

       });
     })(jQuery);
  • 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-05T08:52:02+00:00Added an answer on June 5, 2026 at 8:52 am

    The best way to do this is to wrap both your box and button in a containing element, and bind your hover events to that, instead. Here is a simple demonstration, code here:

    HTML:

    <div class="container">
        <input type="button" value="Hover here">
    
        <div class="box">
            Box content
        </div>
    </div>​
    

    jQuery:

    $(document).ready(function() {
        $('.container').hover(function() {
            $(this).children('.box').show();        
        }, function() {
            $(this).children('.box').hide();
        });        
    });​
    

    Because the events are bound on the containing element, the mouse won’t leave it when it moves from the button to the box.

    Note that the container is a block element, so takes 100% of the width, so you’ll need to either give it a fixed with, display: inline or display: inline-block.

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

Sidebar

Related Questions

I have looked around stackoverflow and search the internet but did not find a
I'm facing a weird problem. I looked around all over stackoverflow.com and elsewhere, but
I have looked through the answers in this forum but cannot seem to find
I've looked all over the web and stackoverflow and can't find anyone talking about
Preface: I have looked all over stackoverflow.com and google for this. I have found
I have looked over a few similar questions here at stackoverflow and I can't
I have looked for the answer to this on Google and stackoverflow, but unfortunately
I have looked at multiple other question similarly asked on StackOverflow, but nothing seems
Hi I have looked at a variety of resources including Stackoverflow on how to
Have looked quite hard for this answer but having no luck. I have 3

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.