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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:29:26+00:00 2026-06-09T02:29:26+00:00

When mousing over certain buttons on my site, I’d like for tooltips to appear

  • 0

When mousing over certain buttons on my site, I’d like for tooltips to appear that instruct users. Basically, whenever a button with the ‘has_tooltip’ class is moused over, a tooltip is attached.

$('.has_tooltip').live({
    mouseenter  : function(e) {
        if($('#tooltip_container').length > 0){
            $('#tooltip_container').remove();
        }

        var $t = $(this), text = $t.attr('rel'), left = e.pageX-25, top = e.pageY-25;
        if($t.attr('rev') === '1') {
            text += ' <span class="tooltip_warning">You must be <a href="/users/login" class="modal-dynamic">logged in</a> to make use of this.</span>'
        }
        $tooltip = $('<div id="tooltip_container">'+text+'</div>');
        $('body').prepend($tooltip);

        $tooltip.css({
            left: left+'px',
            top: top+'px'
        });

    },

});

And when a user’s cursor leaves the newly created tooltip box, it should disappear

$('#tooltip_container').live({
    mouseleave : function(e){
        $(this).remove();
    }

});

However, a fast moving mouse over a button with the ‘has_tooltip’ class adds the tooltip, but moves too quickly for the mouseleave event to trigger.

Anyone have some tips on how I can fix this?

  • 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-09T02:29:27+00:00Added an answer on June 9, 2026 at 2:29 am

    ‘If the mouse does not enter the tooltip (the tooltip appears below the mouse), the browser may not trigger the mouseleave event. You may want to add an additional selector. Try this:

    $('#tooltip_container','.has_tooltip').live({
        mouseleave : function(e){
            $('#tooltip_container').remove();
        }
    });
    

    I would highly recommend removing the HTML from your tooltip method though… try creating an empty div and add the tooltip text and positioning when you go to show it — try to add as little to the DOM as possible (create a hidden div for most of the tooltip HTML and only change the actual text content of it as necessary).

    Ideally, your mouseenter should simply replace the tooltip text and show the div with correct positioning. The mouseleave event should just hide() the tooltip div (not remove it from the DOM just to be created and added again later).

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

Sidebar

Related Questions

I'd like to label points in a ggplot interactively, so that mousing over a
When mousing over an image in a jcarousel, my site displays a popup whose
I currently am using a script that executes a fade effect when mousing over
Would someone mind checking my site in Firebug? It looks like the jquery hide/show
The issue I'm seeing is that mouse over events don't seem to bubble when
I'm trying to display a button when an input field is hovered over. Everything
The XAML below does not work (the text does not change when mousing over):
I've attached the website as I can't recreate it in jsfiddle. When mousing over
I have a db that stores exception messages. I would like to create a
Objective Have a small magnifying glass icon that appears in the top right corner

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.