I'm developing a last.fm widget, and one of the requisites is, for each track that is displayed of a certain tag (genre), a small button must be present. This is so that a tooltip appears when the button is clicked, showing more information about a certain artist, their albums, and their most popular track. This is all done with Ajax requests.
My page is live here. I have managed to get everything working except the tooltip, which I'd like to get showing when someone clicks the little 'i' button icon next to each track.
Some questions arise, though:
- I will need to fetch the data from last.fm with Ajax for the tooltip and then position the tooltip so that it shifts automatically according to the button that's pressed.
My code that shows the 'i' icon next to each track is just this (positioned relatively with CSS after):
<dd class="lfm_info"><img src="images/info.png" /></dd>
The Ajax function creates X buttons depending on how many tracks have been selected. However, from what I've been reading, only one tooltip should be created, outside any tags (but inside the <body
tag, of course) and this should be shifted programmatically. Is this the correct approach?
I've also noticed that there seems to be a huge amount of JQuery plugins to handle tooltips, and I've not managed to get even one to work because of issue 1) - I don't know how to position them, so they show up in random places of my page if I place the tags outside my repeating track <div>
's, and don't even show up at all if I place it inside those said tags. Which do you think is the best plugin to handle/create tooltips? I'd like something clean, and that handles automatic positioning easily.
Thank you for reading, and I hope someone may be able to assist me.
Here is a basic example. It's actually really simple, but obviously without knowing the full user scenario there will be issues with it that will require you to tweak.
Demo: http://jsfiddle.net/dj9xS/3/
The problems:
HTML:
jQuery:
I hope this is helpful for you though.