diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-06-02 14:11:55 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-06-02 14:11:55 +0200 |
commit | 8deb745a4a29351ef1f1e240b06e10bbb37579e5 (patch) | |
tree | dae42f89f3bfc24bd5709657c9f8b9614ee7f8fd /ui | |
parent | afe0f72945170879571ebaf060a816b39c9871b8 (diff) | |
parent | 2a27499ee4ab8076f7c342934af63ad4827f2533 (diff) | |
download | jquery-ui-8deb745a4a29351ef1f1e240b06e10bbb37579e5.tar.gz jquery-ui-8deb745a4a29351ef1f1e240b06e10bbb37579e5.zip |
Merge branch 'master' into widget-factory-demo
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 21 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 18 |
2 files changed, 27 insertions, 12 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index d30e49c66..f19061bc3 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -22,13 +22,19 @@ $.widget( "ui.tooltip", { content: function() { return $( this ).attr( "title" ); }, + hide: true, items: "[title]", position: { my: "left+15 center", at: "right center", collision: "flip fit" }, - tooltipClass: null + show: true, + tooltipClass: null, + + // callbacks + close: null, + open: null }, _create: function() { @@ -132,16 +138,13 @@ $.widget( "ui.tooltip", { tooltip .stop( true ) .position( $.extend({ - of: target, - using: function( pos ) { - // we only want to hide if there's no custom using defined - $( this ).css( pos ).hide(); - } - }, this.options.position ) ); + of: target + }, this.options.position ) ) + .hide(); this._show( tooltip, this.options.show ); - this._trigger( "open", event ); + this._trigger( "open", event, { tooltip: tooltip } ); this._bind( target, { mouseleave: "close", @@ -175,7 +178,7 @@ $.widget( "ui.tooltip", { target.unbind( "mouseleave.tooltip blur.tooltip" ); - this._trigger( "close", event ); + this._trigger( "close", event, { tooltip: tooltip } ); }, _tooltip: function( element ) { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index da52a5a9c..00bc07c4f 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -375,9 +375,20 @@ $.Widget.prototype = { $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + var hasOptions, + effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; options = options || {}; - var hasOptions = !$.isEmptyObject( options ), - effectName = options.effect || defaultEffect; + if ( typeof options === "number" ) { + options = { duration: options }; + } + hasOptions = !$.isEmptyObject( options ); options.complete = callback; if ( options.delay ) { element.delay( options.delay ); @@ -387,11 +398,12 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); } else { - element.queue( function() { + element.queue(function( next ) { $( this )[ method ](); if ( callback ) { callback.call( element[ 0 ] ); } + next(); }); } }; |