I have a collection of 5 clickable circles, each with a unique ID and its own tooltip text that is sourced from an xml Data Interface.
jQuery(function ($) {
$.ajax({
type: "GET",
url: 'steel_agg_bof_flash_en.xml',
dataType: "xml",
success: xmlParser
});
function xmlParser(xml) {
$(xml).find("hotspot").each(function () {
var position = $(this).find('position').text();
var arr = position.split(",");
var hotspotid = $(this).find('hsid').text();
var title = $(this).find('title').text();
$('#clickAreas').prepend('<div id="'+ hotspotid +'_clickable" class="circle" onclick="changeStyle(id);" style="background: #004593; position: absolute; top: ' + arr[1] + 'px' + '; left: ' + arr[0] + 'px' +'; width: ' + Math.floor(arr[2]/3.28148) + 'px; height: '+ Math.floor(arr[2]/3.28148) + 'px; border-radius: 100%; cursor: pointer; opacity: 0.5;"><div class="tooltip"><p style="color: #ffffff;"> ' + title + '</p></div></div>');
});
}
});
The resulting HTML output can be seen at this link - http://jsfiddle.net/HJf8q/1860/
Later on, I added some CSS and Javascript to achieve the following:
- When hovering over a circle, the tooltip should fade in, and when moving the mouse out of the circle, the tooltip should fade out (Check out the issue I faced with a single circle here - http://jsfiddle.net/HJf8q/1851/),
- I'm having trouble displaying the corresponding tooltip text for each circle individually when hovered over, as it currently affects all circles at once. Any help or guidance would be greatly appreciated.