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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:07:07+00:00 2026-06-04T22:07:07+00:00

i have used this tooltip in my project its working great but the problem

  • 0

i have used this tooltip in my project its working great but the problem is that i need the tooltip appear where ever i hover and not fixed location.currently its appearing in fixed location.i need to appear the tooltip where i hover.

how can i retouch this code to do so

  /* Position the tooltip relative to the class 
       associated with the tooltip                */  
    setTip = function(top, left){  
        var topOffset = tip.height();  
        var xTip = (left-30)+"px";  
        var yTip = (top-topOffset-60)+"px";  
        tip.css({'top' : yTip, 'left' : xTip});  
    }  

the full code is here

  $.fn.betterTooltip = function(options){

/* Setup the options for the tooltip that can be 
   accessed from outside the plugin              */
var defaults = {
    speed: 200,
    delay: 300
};

var options = $.extend(defaults, options);

/* Create a function that builds the tooltip 
   markup. Then, prepend the tooltip to the body */
getTip = function() {
    var tTip = 
        "<div class='tip'>" +
            "<div class='tipMid'>"  +
            "</div>" +
            "<div class='tipBtm'></div>" +
        "</div>";
    return tTip;
}
$("body").prepend(getTip());

/* Give each item with the class associated with 
   the plugin the ability to call the tooltip    */
$(this).each(function(){

    var $this = $(this);
    var tip = $('.tip');
    var tipInner = $('.tip .tipMid');

    var tTitle = (this.title);
    this.title = "";

    var offset = $(this).offset();
    var tLeft = offset.left;
    var tTop = offset.top;
    var tWidth = $this.width();
    var tHeight = $this.height();

    /* Mouse over and out functions*/
    $this.hover(
        function() {
            tipInner.html(tTitle);
            setTip(tTop, tLeft);
            setTimer();
        }, 
        function() {
            stopTimer();
            tip.hide();
        }
    );         

    /* Delay the fade-in animation of the tooltip */
    setTimer = function() {
        $this.showTipTimer = setInterval("showTip()", defaults.delay);
    }

    stopTimer = function() {
        clearInterval($this.showTipTimer);
    }

    /* Position the tooltip relative to the class 
       associated with the tooltip                */
    setTip = function(top, left){
        var topOffset = tip.height();
        var xTip = (left-30)+"px";
        var yTip = (top-topOffset-60)+"px";
        tip.css({'top' : yTip, 'left' : xTip});
    }

    /* This function stops the timer and creates the
       fade-in animation                          */
    showTip = function(){
        stopTimer();
        tip.animate({"top": "+=20px", "opacity": "toggle"}, defaults.speed);
    }
});
    };
  • 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-04T22:07:10+00:00Added an answer on June 4, 2026 at 10:07 pm

    .hover(handlerIn, handlerOut) is short for .mouseenter(handlerIn).mouseleave(handlerOut). That means you have access to the mouse coords of the mousenter().

    Change your .hover binding to use mouse coordinates of hover entry point:

    /* Mouse over and out functions*/
    $this.hover(
        function(e) {
            tipInner.html(tTitle);
            setTip(e.clientY, e.clientX);  //<--- using mouseenter coords here
            setTimer();
        }, 
        function() {
            stopTimer();
            tip.hide();
        }
    ).mousemove (function(e) {
        setTip(e.pageY, e.pageX);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used This guide . But if i add it to another project,
I have used this code for extracting urls from web page.But in the line
I have used this code but the result is not the information of the
I have used this plugin before but now the blockui is not positioning correctly
I have used a few different tooltip plugins over the years, but I think
I have used the following code. This code works sometime but sometime not works.
I have used this website for testing http://www.webpagetest.org and among some suggestions for optimization
I have used this code (kind of tutorial) at http://code.google.com/p/gwt-examples/wiki/gwt_hmtl5 ... In this code,
I have used this custom grid view in my code, and I want to
i have used this: Margins margins = new Margins(5, 5, 5, 5); printForm1.PrinterSettings.DefaultPageSettings.Margins =

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.