简体   繁体   English

影像图; 将鼠标悬停在特定区域时显示文本

[英]Imagemap; show text when hovering over certain area

logocopy3 Im having issues linking a specific part of an image (area map) with the hover effect. logocopy3 Im在将图像的特定部分(区域图)与悬停效果链接时遇到问题。 Currently I have the ability to click each section of the imagemap and it directs me to the required page, however I would like the hover effect to be displayed before the user clicks so they know which page they are navigating to. 目前,我可以单击图像映射的每个部分,并将其定向到所需的页面,但是我希望在用户单击之前显示悬停效果,以便他们知道要导航到的页面。 Basically Im trying to display a text which stays in the same position sitting above the image map each time the user hovers over a specific area. 基本上,每次用户将鼠标悬停在特定区域上时,我都会尝试显示停留在图像地图上方相同位置的文本。

My code is as follows: 我的代码如下:

 <div>     
<img src="logocopy3.png" id="logo" style="width: 260px; max-width: 100%;    
height: auto;" alt="" usemap="#map" />

<map name="map">
    <area shape="circle" coords="243,132,41" href="Ktrack.html" alt=''/>
    <area shape="circle" coords="189,223,41" alt='' href="Kinsurance.html" />
    <area shape="circle" coords="69,205,29" alt='' href='Khealth.html'/>
    <area shape="circle" coords="9,131,42" alt='' href='Klocklock.html' />
    <area shape="circle" coords="128,49,81" alt='' href='index.html'/>
</map>

</div> 

I have created a demo using tooltipster jquery plugin and this is the best way I have found to do so ;) 我已经使用tooltipster jquery插件创建了一个演示,这是我发现的最佳方法;)

 $(document).ready(function() { $('.tooltip').tooltipster({ }); }); 
 <script src="http://code.jquery.com/jquery-1.10.0.min.js"></script> <script src="http://iamceege.github.io/tooltipster/dist/js/tooltipster.bundle.js"></script> <link href="http://iamceege.github.io/tooltipster/dist/css/tooltipster.bundle.min.css" rel="stylesheet" /> <div> <img src="https://i.stack.imgur.com/JRo8A.png" id="logo" style="width: 260px; max-width: 100%; height: auto;" alt="" usemap="#map" /> <map name="map"> <area shape="circle" coords="243,132,41" href="Ktrack.html" class="tooltip" title="This is my image's tooltip message for area 1!" /> <area shape="circle" coords="189,223,41" alt='' href="Kinsurance.html" class="tooltip" title="This is my image's tooltip message for area 2!"/> <area shape="circle" coords="69,205,29" alt='' href='Khealth.html' class="tooltip" title="This is my image's tooltip message for area 3!"/> <area shape="circle" coords="9,131,42" alt='' href='Klocklock.html' class="tooltip" title="This is my image's tooltip message for area 5!" /> <area shape="circle" coords="128,49,81" alt='' href='index.html' class="tooltip" title="This is my image's tooltip message for area 6!" /> </map> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM