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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:29:02+00:00 2026-05-21T23:29:02+00:00

Hi all I try to make my own tooltip script which follow my mouse

  • 0

Hi all I try to make my own tooltip script which follow my mouse with jQuery. Everything is okey but when I hover on link and wait few seconds browser use title for own tooltip. How I can stop this?!

I look for solution without removing of title tag.

My code:

<html>
<head>
    <title>Tooltip</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("a").mousemove("mouseover", function(e) {
                var x = e.clientX;
                var y = e.clientY-30;               
                var text = $(this).attr("title");
                var i = 0;
                for(i=0;i<1;i++) {
                    if(i=0) {
                        $("body").append('<div class="tooltip" style="margin-top:'+y+'px; margin-left: '+x+'px;">'+text+'</div>');
                    } else { 
                        $("div.tooltip").remove(); 
                        $("body").append('<div class="tooltip" style="margin-top:'+y+'px; margin-left: '+x+'px;">'+text+'</div>');
                    }
                }
            });
            $("a").mouseout(function() {
                $("div.tooltip").remove();
            });
        });
    </script>
    <style>
        body {
            top: 0px;
            left: 0px;
            margin: 0;
            padding: 0;
        }
        a {
            text-decoration: none;
        }
        div.tooltip {
            background-color: #123534;
            position: fixed;
            z-index: 2;
            padding: 5px;
            heigth: 30px;
        }
        div.menu {

            background-color: #666666;
            margin-left: 100px;
            margin-top: 100px;
            position: fixed;
            width: auto;
            z-index: 1;
        }
        ul {
            margin: 0;
            padding: 5px;
            list-style-type: none;
        }
        li {
            display: inline;
        }
    </style>
</head>
<body>
    <div class="menu">
        <ul>
            <li>
                <a href="#" title="test" >Link</a>
            </li>
            <li>
                <a href="#" title="asd" >Link</a>
            </li>
            <li>
                <a href="#" title="123" >Link</a>
            </li>
        </ul>

    </div>
</body>
</html>

And If anyone knows how to optimize my script I’ll be very thankful ;]

  • 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-21T23:29:02+00:00Added an answer on May 21, 2026 at 11:29 pm

    It’s very simple. You just need to place your tooltip data in another attribute. I use the html5 spec and do “data-tooltip”.

    HTML:

    <a href="#" data-tooltip="my link tooltip content">My Link</a>
    

    JS:

    var text = $(this).data("tooltip");
    

    — OR —

    If, for whatever reason you can’t edit the markup, you could do it programatically. You would have to do it before the mouseover on document.ready like:

    $(document).ready(function() {
    
        $("a").each(function() { 
    
            var $this = $(this);
    
            $this
                .data("tooltip", $this.attr("title"))
                .removeAttr("title");
    
        });
    
    });
    

    Then, in your mousemove, as I mentioned above, you would pull it with:

    var text = $(this).data("tooltip");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to generate title in all levels of the officers but I get
im trying to make my own kernel.... my kernel is loaded through grub...which i
I'm trying to make my own custom view, currently all it does is draw
I found all things working with alert box,dialog box but when i try creating
I am trying to make net-snmp to support my own MIB, but I failed.
By referring to C++ catching all exceptions try { int i = 0; int
I've been struggling all morning to try and work out how mod_rewrite works after
I try to get all WPF window controls collections. In other words i try
I try to read out all existing calendars. I want have a HashMap with
I try to read out all existing calendars. I tried the example from here:

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.