Was working with the jQuery UI Tooltip today and came across some things that just didn't make sense and wanted to make sure I was not over looking something.
So, in the demos it is basically selecting a wrapping DIV, then with the "items" option the tool tip code is grabbing a "target" of the closest item the matches those "items". Although this makes sense in the demos giving it is quite limiting. Say we have a scenario where the tooltip will get triggered by a TD and I want that tooltip's content to be of the content that is in a hidden DIV within that TD.
- <td class="tt">
- Shipped
- <div class="tt-content">
- </div>
- </td>
In the current state of the Tooltip does not work as expect even if I do below:
- $( ".tt" )
- .mouseenter(
- function(){
- $( '.tt-content', this )
- .tooltip(
- {
- items: ".tt-content"
- content: function() {
- var element = $( this );
- if ( element.is( ".tt-content" ) ) {
- return element.html();
- }
- }
- }
- ).tooltip( 'open' );
- }
- )
- .mouseleave(
- function(){
- $( '.tt-content', this ).tooltip( 'close' );
- }
- );
There are a few issues with this 1. that JS code is not elegant at all, 2. the positioning does not work because the Tooltip code will position off of the "tt-content" class and not the item I want to be positioned from.
So, before I get all crazy with adding changes to the tooltip code and pushing (or pulling, still new to the github thing) the changes, I want to make sure there was not a strict reasoning behind the current set up. I've read the wiki multiple times and just want to be sure.
---