Reputation:
We are using jquerytools
and want to use the tooltip
functionality for showing content
loaded through AJAX
.
The documentation of jquerytools tooltip
say that the content of the tooltip
must be contained within the HTML
directly after the element that should receive
the tooltip
.
Is there no better way? The UI is too complex and this requirement sux.
how would you implement a jquerytools tooltip
functionality with tooltip
content sucked in through AJAX
?
Upvotes: 1
Views: 2273
Reputation: 6199
I am using a customized version of tiptip:
http://code.drewwilson.com/entry/tiptip-jquery-plugin
however, why can't you just use ajax to dynamically insert an element after for tooltip content?
you can have a "template" div somewhere like so:
<div id="tooltip-template" style="display:none"><span></span>...</div>
and inside your callback:
$.ajax(
{
url: '...',
type: "POST",
data: JSON.stringify(...),
success: function(result)
{
var tooltip = $("#tooltip-template").clone( );
tooltip.find("span").html(result.name);
var target = $("#tooltip-target");
target.after(tooltip);
target.tooltip( );
}
});
Upvotes: 2