I'm an old (circa 2008) Flash guy, more designer than programmer. Haven't programmed in years.
I'm trying to implement Tooltipster on the site I'm building (it's all html/jQuery), with just one sort of usage, but I need to be able to load the content on-demand so that I don't have a huge initial load...there will be many dozens on a single page; namely a tooltip that you can click links in, and has images and text (and whatever other html), and doesn't disappear until you move out of the content area.
On the Tooltipster homepage, there is info on loading with ajax, but I don't quite understand it.
In simple terms, how can I turn this following code into ajax-load instances? There may be many dozens of these on a single page, as noted. For example, I suppose demo-interact needs to be an html page, as will all other instances, but I'm out of my league here:
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
<tr>
<td> <a href="#"><span id="demo-interact"
title="Try clicking
<a href='http://google.com/' target='_blank'>
this link
</a>
<strong>
This text is in bold case!
</strong>
<img src='spiderman.png'/>
">This</span></a> will hover until you move away from the tooltip itself, i.e. it's clickable</td>
<td> </td>
</tr>
</table>
On the project's homepage, it shows how to load html files using ajax, but as I say, it's a bit beyond me. I assume the containing tag needs an ID and that ID would be passed into the function instead of example.php (below),,,or something like that?
$('.tooltip').tooltipster({
content: 'Loading...',
functionBefore: function(origin, continueTooltip) {
// we'll make this function asynchronous and allow the tooltip to go ahead and show the loading notification while fetching our data
continueTooltip();
// next, we want to check if our data has already been cached
if (origin.data('ajax') !== 'cached') {
$.ajax({
type: 'POST',
url: 'example.php',
success: function(data) {
// update our tooltip content with our returned data and cache it
origin.tooltipster('content', data).data('ajax', 'cached');
}
});
}
}
});
It all comes from here: http://iamceege.github.io/tooltipster/#demos
Any help would be appreciated:)
Shawn