css - jQuery: Tooltip Positioning -


i'm trying figure out how center tooltip under link (so it's not positioned in line link).

                   [link]       [tooltip should appear this]                     [link]                    [tooltip should not appear this] 

i'm trying figure out why tooltip not fading in.

http://jsfiddle.net/fj4xz/

there :

$('a.tooltip').hover(function() {     var title = $(this).attr('title');     var offset=$(this).offset();     var width=$(this).outerwidth();     var height=$(this).outerheight();     $content=$('<div class="tooltip">' + title + '</div>').fadein();     $(this).append($content);     var middle = offset.left+(width-$content.outerwidth())/2;     // middle = math.max(offset.left,offset.left+(width-$content.outerwidth())/2 );     $content.offset({ top: offset.top+height, left: middle });     $('div.tooltip').hover(function() {         $(this).fadeout('fast');                 }); }, function() {     $(this).find('div').fadeout('fast'); }); 

​ can make code more readable, idea there ;)

[edit] code changed, text has centered if long. (i misread question)


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -