From a47f5dc4f21762126ff460af9f49dffeb36e4086 Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 13 Jun 2012 05:07:26 -0400 Subject: 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. --- demos/tooltip/tracking.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'demos/tooltip') diff --git a/demos/tooltip/tracking.html b/demos/tooltip/tracking.html index 9f9ce1752..033bc9766 100644 --- a/demos/tooltip/tracking.html +++ b/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 -- cgit v1.2.3 From 5c2cf39dff34b4598b214b1a2a1f3b48d15f0366 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 14 Jun 2012 01:02:11 +0200 Subject: Tooltip: Add track option --- demos/tooltip/tracking.html | 22 +--------------------- tests/unit/tooltip/tooltip_common.js | 1 + ui/jquery.ui.tooltip.js | 29 ++++++++++++++++++++++++----- 3 files changed, 26 insertions(+), 26 deletions(-) (limited to 'demos/tooltip') diff --git a/demos/tooltip/tracking.html b/demos/tooltip/tracking.html index 033bc9766..ab0237da6 100644 --- a/demos/tooltip/tracking.html +++ b/demos/tooltip/tracking.html @@ -19,27 +19,7 @@ diff --git a/tests/unit/tooltip/tooltip_common.js b/tests/unit/tooltip/tooltip_common.js index d12ee9519..6d503aecd 100644 --- a/tests/unit/tooltip/tooltip_common.js +++ b/tests/unit/tooltip/tooltip_common.js @@ -11,6 +11,7 @@ TestHelpers.commonWidgetTests( "tooltip", { }, show: true, tooltipClass: null, + track: false, // callbacks close: null, diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index c4bdbb0d7..2c80f328c 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -54,6 +54,7 @@ $.widget( "ui.tooltip", { }, show: true, tooltipClass: null, + track: false, // callbacks close: null, @@ -145,13 +146,14 @@ $.widget( "ui.tooltip", { }, _open: function( event, target, content ) { + var tooltip, positionOption; if ( !content ) { return; } // Content can be updated multiple times. If the tooltip already // exists, then just update the content and bail. - var tooltip = this._find( target ); + tooltip = this._find( target ); if ( tooltip.length ) { tooltip.find( ".ui-tooltip-content" ).html( content ); return; @@ -175,11 +177,25 @@ $.widget( "ui.tooltip", { tooltip = this._tooltip( target ); addDescribedBy( target, tooltip.attr( "id" ) ); tooltip.find( ".ui-tooltip-content" ).html( content ); - tooltip - .position( $.extend({ + + function position( event ) { + positionOption.of = event; + tooltip.position( positionOption ); + } + if ( this.options.track && /^mouse/.test( event.originalEvent.type ) ) { + positionOption = $.extend( {}, this.options.position ); + this._on( this.document, { + mousemove: position + }); + // trigger once to override element-relative positioning + position( event ); + } else { + tooltip.position( $.extend({ of: target - }, this.options.position ) ) - .hide(); + }, this.options.position ) ); + } + + tooltip.hide(); this._show( tooltip, this.options.show ); @@ -235,6 +251,9 @@ $.widget( "ui.tooltip", { target.removeData( "tooltip-open" ); this._off( target, "mouseleave focusout keyup" ); + // TODO use _off + this.document.unbind( "mousemove.tooltip" ); + this.closing = true; this._trigger( "close", event, { tooltip: tooltip } ); this.closing = false; -- cgit v1.2.3 From 92fb5567a25080f2064710fc24f0c6c073424cf3 Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 15 Jun 2012 12:47:12 -0400 Subject: Effects: Renamed all files. --- demos/addClass/default.html | 2 +- demos/animate/default.html | 2 +- demos/datepicker/animation.html | 14 +- demos/dialog/animated.html | 6 +- demos/dialog/modal-form.html | 2 +- demos/effect/default.html | 28 +- demos/effect/easing.html | 2 +- demos/hide/default.html | 24 +- demos/index.html | 26 +- demos/removeClass/default.html | 2 +- demos/show/default.html | 24 +- demos/switchClass/default.html | 2 +- demos/toggle/default.html | 24 +- demos/toggleClass/default.html | 2 +- demos/tooltip/custom-animation.html | 4 +- demos/tooltip/video-player.html | 4 +- grunt.js | 2 +- tests/unit/effects/effects.html | 28 +- tests/visual/addClass/queue.html | 2 +- tests/visual/effects/all.html | 28 +- tests/visual/effects/scale.html | 4 +- tests/visual/tooltip/animations.html | 10 +- ui/jquery.effects.blind.js | 81 ---- ui/jquery.effects.bounce.js | 112 ------ ui/jquery.effects.clip.js | 66 ---- ui/jquery.effects.core.js | 739 ----------------------------------- ui/jquery.effects.drop.js | 64 --- ui/jquery.effects.explode.js | 96 ----- ui/jquery.effects.fade.js | 29 -- ui/jquery.effects.fold.js | 75 ---- ui/jquery.effects.highlight.js | 49 --- ui/jquery.effects.pulsate.js | 62 --- ui/jquery.effects.scale.js | 290 -------------- ui/jquery.effects.shake.js | 73 ---- ui/jquery.effects.slide.js | 65 --- ui/jquery.effects.transfer.js | 46 --- ui/jquery.ui.effect-blind.js | 81 ++++ ui/jquery.ui.effect-bounce.js | 112 ++++++ ui/jquery.ui.effect-clip.js | 66 ++++ ui/jquery.ui.effect-drop.js | 64 +++ ui/jquery.ui.effect-explode.js | 96 +++++ ui/jquery.ui.effect-fade.js | 29 ++ ui/jquery.ui.effect-fold.js | 75 ++++ ui/jquery.ui.effect-highlight.js | 49 +++ ui/jquery.ui.effect-pulsate.js | 62 +++ ui/jquery.ui.effect-scale.js | 290 ++++++++++++++ ui/jquery.ui.effect-shake.js | 73 ++++ ui/jquery.ui.effect-slide.js | 65 +++ ui/jquery.ui.effect-transfer.js | 46 +++ ui/jquery.ui.effect.js | 739 +++++++++++++++++++++++++++++++++++ 50 files changed, 1968 insertions(+), 1968 deletions(-) delete mode 100644 ui/jquery.effects.blind.js delete mode 100644 ui/jquery.effects.bounce.js delete mode 100644 ui/jquery.effects.clip.js delete mode 100644 ui/jquery.effects.core.js delete mode 100644 ui/jquery.effects.drop.js delete mode 100644 ui/jquery.effects.explode.js delete mode 100644 ui/jquery.effects.fade.js delete mode 100644 ui/jquery.effects.fold.js delete mode 100644 ui/jquery.effects.highlight.js delete mode 100644 ui/jquery.effects.pulsate.js delete mode 100644 ui/jquery.effects.scale.js delete mode 100644 ui/jquery.effects.shake.js delete mode 100644 ui/jquery.effects.slide.js delete mode 100644 ui/jquery.effects.transfer.js create mode 100644 ui/jquery.ui.effect-blind.js create mode 100644 ui/jquery.ui.effect-bounce.js create mode 100644 ui/jquery.ui.effect-clip.js create mode 100644 ui/jquery.ui.effect-drop.js create mode 100644 ui/jquery.ui.effect-explode.js create mode 100644 ui/jquery.ui.effect-fade.js create mode 100644 ui/jquery.ui.effect-fold.js create mode 100644 ui/jquery.ui.effect-highlight.js create mode 100644 ui/jquery.ui.effect-pulsate.js create mode 100644 ui/jquery.ui.effect-scale.js create mode 100644 ui/jquery.ui.effect-shake.js create mode 100644 ui/jquery.ui.effect-slide.js create mode 100644 ui/jquery.ui.effect-transfer.js create mode 100644 ui/jquery.ui.effect.js (limited to 'demos/tooltip') diff --git a/demos/addClass/default.html b/demos/addClass/default.html index 98f7c8c50..9d4b71455 100644 --- a/demos/addClass/default.html +++ b/demos/addClass/default.html @@ -5,7 +5,7 @@ jQuery UI Effects - addClass demo - +