jquery - Tooltip not working the way it should in chrome -
following fiddle trying display tooltip on map tag of image. tooltip works fine if using firefox doesnot work fine on chrome. kindly take @ following fiddle , hover on edges of image , you'll see instead of bottom tooltip appearing @ top left. kindly let me know how can fix chrome:
<div class="pull-left"> <br> <br> <br> <br> <img width="54" height="17" border="0" style="margin-left:15px;" usemap="#map" alt="" src="http://www.dscl.org/etitles/device-apple-mac-button.jpg"> <map name="map"> <area href="#hmm" coords="2,0,21,19" shape="rect" title="" onclick="showsection('qal')" data-placement="bottom" data-toggle="tooltip" class="grid-menu" data-original-title="why not on bottom?"> <area href="#hmm" coords="36,-1,56,19" shape="rect" title="" onclick="showsection('qa')" data-placement="bottom" data-toggle="tooltip" class="grid-menu" data-original-title="questions | answers"> </map> </div>
the code bootstrap using determine draw imagemap returning unexpected results in chrome areas.* unfortunately, there's no straightforward way change how calculates position explicit case.
as such, initial thought change way applying tooltips. if instead of using tooltip applied image map areas, locate based on image, , toggle based on mouseover/mouseout of map areas, think arrive @ desired results.
instead of
$('.grid-menu').tooltip();
try
$('.grid-menu').on('mouseover', function () { $('#myimg').tooltip({placement: 'bottom', title: $(this).data('original-title')}); $('#myimg').tooltip('show'); }).on('mouseout', function () { $('#myimg').tooltip('hide') });
see fiddle here - note removed 1 of areas because of uncertainty whether coordinates correct. should work fine regardless of how many areas use, though - important thing it's getting them title.
http://jsfiddle.net/sheldon_griffin/bfy56/1/
*bootstrap calling getboundingclientrect() on area element, , returning 0 properties. possibly correct, possibly not (it seems either firefox or chrome giving wrong answer, though), wrong answer situation.
Comments
Post a Comment