jQuery (non plugin) tooltip using jQuery ui position - How can this be improved? -


i need reviewing basic tooltip using jquery ui position. jquery tooltip gets title attribute off link , creates tooltip on hover of link. how can code improved , or made more efficient? wanted post here in hopes helps others. sure spent enough time on thought simple.

here code (would love people post alternate versions):

http://jsfiddle.net/pn4bw/

$(".tip a").hover(     function() {     var tiptext = $(this).attr("title");     $("<div class='tooltip' style='display:none;'>" + tiptext + " </div>").insertafter(this); $('.tooltip').position({     my: "left top",     at: "right top",     of: this,     collision: "flip" }); //is there better way select tooltip? $(this).next().fadein(500); //should fade in way?             }, function() { //should use better selector? $(this).next().fadeout('slow', function() {     $(this).remove();     }); });​ 
  • should using ui position or other technique? i'm open better solutions.
  • do know of better non plugin jquery tooltip?
  • i refuse use plugin this.
  • i heart stackoverflow
  • jquery ui .position used above - http://jqueryui.com/demos/position/

ideas, thoughts, comments? all, hope helps others well!

use of jqueryui position() method dependent on if using jqueryui in page or not. waste load if need position.

not lot of effort calculate position using link offset offet() method , adustment width using width() method.

if loading jqueryui... position() convenient utility method , saves doing calcs yourself

edit: use of ui position "flip" option require considerably more effort code yourself


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -