Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _open: function( event, target, content ) {
- if ( !content ) {
- return;
- }
- // if we have a title, clear it to prevent the native tooltip
- // we have to check first to avoid defining a title if none exists
- // (we don't want to cause an element to start matching [title])
- // TODO: document why we don't use .removeAttr()
- if ( target.is( "[title]" ) ) {
- target.attr( "title", "" );
- }
- // ajaxy tooltip can update an existing one
- var tooltip = this._find( target );
- if ( !tooltip.length ) {
- tooltip = this._tooltip( target );
- target.attr( "aria-describedby", tooltip.attr( "id" ) );
- }
- // attach the target to the tooltip
- tooltip.data( 'target', target );
- tooltip.addClass( this.options.tooltipClass || "" )
- tooltip.find( ".ui-tooltip-content" ).html( content );
- tooltip
- .stop( true )
- .position( $.extend({
- of: target
- }, this.options.position ) )
- .hide();
- this._show( tooltip, this.options.show );
- this._trigger( "open", event, { tooltip: tooltip } );
- this._bind( target, {
- mouseleave: "close",
- blur: "close"
- });
- }
- _tooltip: function( element ) {
- var id = "ui-tooltip-" + increments++,
- tooltip = $( "<div>" )
- .attr({
- id: id,
- role: "tooltip"
- })
- .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " );
- $( "<div>" )
- .addClass( "ui-tooltip-content" )
- .appendTo( tooltip );
- tooltip.appendTo( document.body );
- if ( $.fn.bgiframe ) {
- tooltip.bgiframe();
- }
- this.tooltips[ id ] = element;
- return tooltip;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement