Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

Commit

Permalink
The original title is not showed in addition to the tooltip when hove…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
arnklint committed Oct 12, 2009
1 parent e5cb2d2 commit dc6b0fa
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions jquery.simple-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ Originally extracted from the easy to use CMS Venio at http://venio.se.

return this.each(function(){
var me = $(this);
var originalTitle = "";
me.hover(function(e){
var title = me.attr('title') && !opts.overrideElementTitle ? me.attr('title') : opts.title;
$("body").append("<p id='v-tooltip'>"+title+"</p>");
$("#v-tooltip")
.css("top",(e.pageY - opts.xOffset) + "px")
.css("left",(e.pageX + opts.yOffset) + "px")
.fadeIn("fast");
originalTitle = me.attr('title');
titleDisplayed = originalTitle && !opts.overrideElementTitle ? originalTitle : opts.title;
me.attr("title","");
if(titleDisplayed.length>0){
$("body").append("<p id='v-tooltip'>"+titleDisplayed+"</p>");
$("#v-tooltip")
.css("top",(e.pageY - opts.xOffset) + "px")
.css("left",(e.pageX + opts.yOffset) + "px")
.fadeIn("fast");
}
},function(){
me.attr("title", originalTitle);
$("#v-tooltip").remove();
});
me.mousemove(function(e){
Expand All @@ -33,4 +39,4 @@ Originally extracted from the easy to use CMS Venio at http://venio.se.
yOffset: 20,
overrideElementTitle: false
}
})(jQuery);
})(jQuery);

0 comments on commit dc6b0fa

Please sign in to comment.