qTip2 - Anchor the tooltip to the mouse

by Asif Sharif Shahid

HTML

<link rel="stylesheet" href="http://qtip2.com/v/stable/jquery.qtip.css">
<script src="http://qtip2.com/v/stable/jquery.qtip.js"></script>
<div id="box"></div>

CSS

body{
    padding: 50px;
}

#box{
    background-color: #eee;
    height: 200px;
}

JavaScript

// Create the tooltips only when document ready
 $(document).ready(function()
 {
     $('#box').qtip({
         content: 'Asif Sharif',
         position: {
             target: 'mouse', // Track the mouse as the positioning target
             adjust: { x: 5, y: 5 } // Offset it slightly from under the mouse
         }
     });
 });