function init_qtip() { $('.qtip_tooltip').each(function() { $(this).qtip({ content: { text: function(event, api) { $.ajax({ url: api.elements.target.attr('qtip_href') }) .then(function(content) { // Set the tooltip content upon successful retrieval api.set('content.text', content); }, function(xhr, status, error) { // Upon failure... set the tooltip content to error api.set('content.text', status + ': ' + error); }); return 'Loading...'; // Set some initial text } }, show: { effect: function() { $(this).fadeTo(500, 1); } }, hide: { effect: function() { $(this).fadeTo(500, 0); } }, position: { viewport: $(window) }, style: 'qtip-bootstrap' }); }); } $(function () { init_qtip(); $("#leafy_loader").html(get_loader_svg('loader_leafy')); init_planet_loader('loader_leafy'); $('[data-toggle="popover"]').popover({container: 'body'}); $('a[data-target=#helpModal], abbr[data-target=#helpModal]').click(function(ev) { ev.preventDefault(); var target = $(this).attr("href"); // load the url and show modal on success $("#helpModal .modal-content").load(target, function() { $("#helpModal").modal("show"); }); }); });