Permalink
Browse files

Tooltip mouse tracking demo: Only track the mouse when the tooltip is…

… opened on hover. Don't let the positioning of one tooltip affect other tooltips.
  • Loading branch information...
1 parent 3d5c618 commit a47f5dc4f21762126ff460af9f49dffeb36e4086 @scottgonzalez scottgonzalez committed Jun 13, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 demos/tooltip/tracking.html
@@ -23,12 +23,15 @@
my: "left+25 center",
at: "center"
},
- open: function( event ) {
- var tooltip = $( ".ui-tooltip" ),
- positionOption = $( this ).tooltip( "option", "position" );
+ open: function( event, ui ) {
+ if ( !( /^mouse/.test( event.originalEvent.type ) ) ) {
+ return;
+ }
+
+ var positionOption = $.extend( {}, $( this ).tooltip( "option", "position" ) );
function position( event ) {
positionOption.of = event;
- tooltip.position( positionOption );
+ ui.tooltip.position( positionOption );
}
$( document ).bind( "mousemove.tooltip-position", position );
// trigger once to override element-relative positioning

0 comments on commit a47f5dc

Please sign in to comment.