I have the following code:
<div style="width:100%" align="center">
<img src="./platform-logos-big.png" alt="Icons of platforms we support: Windows Linux and MacOS X" border="0" align="middle" usemap="#Map">
<map name="Map">
<area shape="rect" coords="0,0,87,100" href="#Linux" alt="Click here to download Linux version of CloudClient">
<area shape="rect" coords="88,0,195,100" href="#Windows" alt="Click here to download Windows version of CloudClient">
<area shape="rect" coords="196,0,300,100" href="#MacOsX" alt="Click here to download MacOsX version of CloudClient">
</map>
</div>
<div class="WTT">
tooltipWin
</div>
<div class="LTT">
tooltipLin
</div>
<div class="MTT">
tooltipMac
</div>
I want to show my pure html tool tips appear on top of mouse and move fllowing it. How to do such thing with jQuery?
I have the following code:
<div style="width:100%" align="center">
<img src="./platform-logos-big.png" alt="Icons of platforms we support: Windows Linux and MacOS X" border="0" align="middle" usemap="#Map">
<map name="Map">
<area shape="rect" coords="0,0,87,100" href="#Linux" alt="Click here to download Linux version of CloudClient">
<area shape="rect" coords="88,0,195,100" href="#Windows" alt="Click here to download Windows version of CloudClient">
<area shape="rect" coords="196,0,300,100" href="#MacOsX" alt="Click here to download MacOsX version of CloudClient">
</map>
</div>
<div class="WTT">
tooltipWin
</div>
<div class="LTT">
tooltipLin
</div>
<div class="MTT">
tooltipMac
</div>
I want to show my pure html tool tips appear on top of mouse and move fllowing it. How to do such thing with jQuery?
Share Improve this question edited Mar 29, 2011 at 21:28 CAbbott 8,0984 gold badges32 silver badges38 bronze badges asked Mar 29, 2011 at 21:07 RellaRella 66.9k112 gold badges373 silver badges642 bronze badges4 Answers
Reset to default 8Stick a title="your tooltip"
on your area
tag.
Really you should give a common class to all the tooltips, and id to all the elements, but this works against your existing HTML.
$('.WTT,.LTT,.MTT').css({
position: 'absolute'
}).hide()
$('area').each(function(i) {
$('area').eq(i).bind('mouseover', function(e) {
$('.WTT,.LTT,.MTT').eq(i).css({
top: e.pageY,
left: e.pageX
}).show()
})
$('area').eq(i).bind('mouseout', function() {
$('.WTT,.LTT,.MTT').hide()
})
})
fiddle here: http://jsfiddle.net/billymoon/BmxR7/
You have different options here:
http://wiki.jqueryui.com/w/page/12138112/Tooltip
EDIT: This link may help also: http://docs.jquery.com/Plugins/Tooltip#Delay_and_tracking
Regarding using jQuery UI for map > area > tooltip, you need to add:
$("area").tooltip({ track: true });
And, the styling:
.ui-tooltip { }