Reputation: 31
I have this code on my site:
$(document).ready(function() {
$('.tooltip-game').jBox('Tooltip', {
closeOnMouseleave: true,
ajax: {
url: 'tooltips/tooltip-game-html.jsp',
reload: true,
getData: 'data-ajax',
setContent: true,
spinner: true
}
});
$( '#tabs-1' ).tabs({
beforeLoad: function( event, ui ) {
ui.panel.html('<div style="text-align: center; vertical-align: middle;"><img src="images/loading.gif" />');
ui.jqXHR.fail(function() {
ui.panel.html("Couldn't load this tab. We'll try to fix this as soon as possible." );
});
}
});
});
I use jQuery Tabs and jQuery tooltips, but after loading external file with ajax, tooltips don't work. I know i have to use .on() function, but I don't know how :(
Thank you very much for your tips.
Upvotes: 3
Views: 886
Reputation: 22158
You need to initialize tooltips after asynchronous call ends.
function tooltips() {
$('.tooltip-game').jBox('Tooltip', {
closeOnMouseleave: true,
ajax: {
url: 'tooltips/tooltip-game-html.jsp',
reload: true,
getData: 'data-ajax',
setContent: true,
spinner: true,
//Take a look to this line
success: function() {
tooltips();
}
}
});
}
$( '#tabs-1' ).tabs({
beforeLoad: function( event, ui ) {
ui.panel.html('<div style="text-align: center; vertical-align: middle;"><img src="images/loading.gif" />');
ui.jqXHR.fail(function() {
ui.panel.html("Couldn't load this tab. We'll try to fix this as soon as possible." );
});
}
});
});
Upvotes: 1