On a page I have a sortable list with thumbnails.
When rolling over the images I wanted a tooltip to show a bigger image.
I found qTip, but maybe there is something better / easier?
How can I connect the imgPath var from the sortable to the qtip?
var imgPath = '<img src="002171/imm/001.jpg" />';
$("#sortable").sortable();
$("#sortable").disableSelection();
$('#sortable li img').qtip({
content: {
text: imgPath
}
});
<div id="demo">
<ul id="sortable">
<li><img src="002171/tn/001.jpg" /></li>
<li><img src="002171/tn/002.jpg" /></li>
<li><img src="002171/tn/003.jpg" /></li>
</ul>
</div>
I posted a demo for you. As much as I like qTip, it isn’t easy to figure out how to set it up to grab content from within the current HTML.. I spent 20 minutes messing with it until I gave up. But, good news is I do know that this tooltip script has three versions, and one is specifically made for image previews.
So you’ll need to reformat your HTML a bit. the
hrefin the<a>contains the large image that shows up in the tooltip while the<img src>contains the thumbnail. You can also include a caption in the tooltip by adding text/HTML into the title attribute of the link (see the first image in the code below).HTML
CSS
Script