| 1 |
jQuery( function( $ ) { |
| 2 |
var tooltipTimeout; |
| 3 |
|
| 4 |
$( '.wp-stream-tooltip-text' ).mouseover( function() { |
| 5 |
var tooltip = $( this ).next( '.wp-stream-tooltip' ), |
| 6 |
left = $( this ).position().left + ( $( this ).width() / 2 ) - ( tooltip.width() / 2 ), // align with center of tooltip text |
| 7 |
top = $( this ).position().top + $( this ).height(); // align with bottom of the tooltip text |
| 8 |
|
| 9 |
clearTimeout( tooltipTimeout ); |
| 10 |
|
| 11 |
tooltip |
| 12 |
.show() |
| 13 |
.css( 'left', left ) |
| 14 |
.css( 'top', top ) |
| 15 |
.outerWidth( $( window ).width() - tooltip.offset().left - 10 ); |
| 16 |
}); |
| 17 |
|
| 18 |
$( '.wp-stream-tooltip-text' ).mouseout( function() { |
| 19 |
tooltipTimeout = setTimeout( function( el ) { el.hide(); }, 10, $( this ).next( '.wp-stream-tooltip' ) ); |
| 20 |
}); |
| 21 |
|
| 22 |
$( '.wp-stream-tooltip' ).mouseover( function() { |
| 23 |
clearTimeout( tooltipTimeout ); |
| 24 |
}); |
| 25 |
|
| 26 |
$( '.wp-stream-tooltip' ).mouseout( function() { |
| 27 |
tooltipTimeout = setTimeout( function( el ) { el.hide(); }, 10, $( this ) ); |
| 28 |
}); |
| 29 |
|
| 30 |
}); |