【发布时间】:2015-05-08 06:02:07
【问题描述】:
我有一个图像映射,当用户将鼠标悬停在该图像的特定部分上时,我想使用 Bootstrap 提供的内置工具提示。
我遇到的问题是工具提示没有显示在正确的位置。现在它显示在图像地图所有区域的图像左上角。
如何将工具提示移动到各自区域下,而不必单独重新定位每个工具提示?它应该自动在定义的rec中。
这是我正在使用的地图代码:
<img id="Image-Maps-Com-process-map" src="images/osh drawing.png" border="0" width="600" height="600" orgWidth="600" orgHeight="600" usemap="#process-map" alt="" />
<map name="process-map" id="ImageMapsCom-process-map">
<area alt="" title="Wood Burning Stove" href="#" class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="478,186,572,296" style="outline:none;" target="_self" />
<area alt="" title="Rough Cut Lumber" href="#" class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="184,1,395,148" style="outline:none;" target="_self" />
<area alt="This is the description maybe" title="Distributing" href="#"class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="45,398,304,577" style="outline:none;" target="_self" />
<area alt="" title="Shipping Materials" href="#"class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="9,52,141,183" style="outline:none;" target="_self" />
<area alt="" title="Sawdust" href="#"class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="302,311,410,385" style="outline:none;" target="_self" />
<area alt="" title="Electricity" href="#"class="tooltip-bot" data-original-title="Title text here" shape="rect" coords="430,0,570,113" style="outline:none;" target="_self" />
<area alt="manufacturing" title="Manufacturing" href="#"class="tooltip-bot" data-original-title="Title text here" shape="poly" coords="348,193,213,197,188,313,221,368,296,362,300,310,357,302,363,193" style="outline:none;" target="_self" />
</map>
【问题讨论】:
-
这只是Bootstrap,他们的代码都没有针对工具提示进行修改
-
在 Firefox 和 chrome 中,工具提示的位置不同。工具提示 div 具有相同的顶部,左侧位置,因此它显示在同一位置。
-
所以你说我需要通过CSS手动设置坐标才能正确显示?还是有更有效的方法?
-
奇怪的是它在 IE 中比 Chrome 或 FF 更好。奇怪
-
我认为你可以使用 Jquery。获取鼠标位置并根据鼠标位置显示。
标签: javascript jquery html css twitter-bootstrap