jQuery to achieve the mouse over the prompt information map hotspot effect

  • 2020-06-01 08:21:25
  • OfStack

jQuery to achieve the mouse over the prompt information map hotspot effect


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Map hotspot effect - Mouse over the pop-up prompt message </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<script src="/ajaxjs/jquery-1.6.2.min.js" type="text/javascript"></script><!--  Suggest using 1.7 the jquery -->
<script type="text/javascript">var jq = jQuery.noConflict();</script><!--  In order to make DZ X2 support jquery  Replace the library at load time $ for jq -->
<style type="text/css">
.map img { width:496px; height: 415px; }
.mapDiv { padding: 5px; width:170px; height:61px; color:#369; background: url('hotarrow.gif') no-repeat; }
</style><!-- CSS style  -->
<body>
<!-- JS  If you need to read variables, you'd better write them in the web page , You could also write it here JS In the file !-->
<script type="text/javascript">
jq(document).ready(function(){
jQuery.fn.extend({
TitleShow: function(strHTML) {
var xOffset = 80;
var yOffset = -75;
var preview = jq("#preview_container");
if(preview.length<=0){
jq("body").append("<div id='preview_container'></div>");
preview = jq("#preview_container");
}
preview.css({
"display":"none",
"position":"absolute",
"width":"150px",
"word-break":"break-all"
});
return this.each(function() {
var _this = jq(this);
_this.hover(
function(e){
preview.html(strHTML);
preview
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.css("opaticy",0)
.show()
.stop()
.animate({"opacity":0.9},300);

},function(){
preview
.stop()
.animate({"opacity":0},300,function(){
jq(this).hide();
});
}
)
_this.mousemove(function(e){
preview
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
});
}
});
jq("#beijing").TitleShow("<div class='mapDiv'> Beijing map hotspot effect - Here is the test line feed effect - Here is the test line feed effect </div>");
jq("#tianjin").TitleShow("<div class='mapDiv'> Tianjin map hotspot effect 2</div>");
jq("#shanghai").TitleShow("<div class='mapDiv'> Shanghai map hotspot effect 3</div>");
jq("#chongqing").TitleShow("<div class='mapDiv'> Chongqing map hotspot effect 4</div>");
jq("#hebei").TitleShow("<div class='mapDiv'> Hebei map hotspot effect 5</div>");
jq("#shanxi").TitleShow("<div class='mapDiv'> Shanxi map hotspot effect 6</div>");
jq("#neimenggu").TitleShow("<div class='mapDiv'> Inner Mongolia map hotspot effect 7</div>");
jq("#liaoning").TitleShow("<div class='mapDiv'> Map hotspot effect 8</div>");
jq("#jilin").TitleShow("<div class='mapDiv'> Map hotspot effect 9</div>");
jq("#heilongjiang").TitleShow("<div class='mapDiv'> Heilongjiang map hotspot effect 10</div>");
jq("#jiangsu").TitleShow("<div class='mapDiv'> Map hotspot effect 11</div>");
jq("#zhejiang").TitleShow("<div class='mapDiv'> Map hotspot effect 12</div>");
jq("#anhui").TitleShow("<div class='mapDiv'> Map hotspot effect 13</div>");
jq("#fujian").TitleShow("<div class='mapDiv'> Map hotspot effect 14</div>");
jq("#jiangxi").TitleShow("<div class='mapDiv'> Map hotspot effect 15</div>");
jq("#shandong").TitleShow("<div class='mapDiv'> Shandong map hotspot effect 16</div>");
jq("#henan").TitleShow("<div class='mapDiv'> Henan map hotspot effect 17</div>");
jq("#hubei").TitleShow("<div class='mapDiv'> Hubei map hotspot effect 18</div>");
jq("#hunan").TitleShow("<div class='mapDiv'> Map hotspot effect l9</div>");
jq("#guangdong").TitleShow("<div class='mapDiv'> Map hotspot effect 20e</div>");
jq("#guangxi").TitleShow("<div class='mapDiv'> Map hotspot effect 21</div>");
jq("#hainan").TitleShow("<div class='mapDiv'> Map hotspot effect 22</div>");
jq("#sichuan").TitleShow("<div class='mapDiv'> Map hotspot effect 23</div>");
jq("#guizhou").TitleShow("<div class='mapDiv'> Map hotspot effect 24</div>");
jq("#yunnan").TitleShow("<div class='mapDiv'> Map hotspot effect 25</div>");
jq("#shaanxi").TitleShow("<div class='mapDiv'> Map hotspot effect 26</div>");
jq("#gansu").TitleShow("<div class='mapDiv'> Map hotspot effect 27</div>");
jq("#qinghai").TitleShow("<div class='mapDiv'> Map hotspot effect 28</div>");
jq("#ningxia").TitleShow("<div class='mapDiv'> Ningxia map hotspot effect 29</div>");
jq("#xinjiang").TitleShow("<div class='mapDiv'> Xinjiang map hotspot effect 30</div>");
jq("#xizang").TitleShow("<div class='mapDiv'> Map hotspot effect 31</div>");
jq("#xianggang").TitleShow("<div class='mapDiv'> Hong Kong map hotspot effect 32</div>");
jq("#aomen").TitleShow("<div class='mapDiv'> Map hotspot effect 33</div>");
jq("#taiwan").TitleShow("<div class='mapDiv'> Map hotspot effect 34</div>");
});
</script>
<!-- hot HTML The code begins to  -->
<div class="map">
<img border="0" usemap="#Map" src="map.png" />
<map name="Map" id="Map">
<area id="beijing" alt=" Beijing " href="#" coords="354,140,380,153" shape="rect">
<area id="shanghai" alt=" Shanghai " href="#" coords="434,246,462,259" shape="rect">
<area id="tianjin" alt=" tianjin " href="#" coords="382,168,408,180" shape="rect">
<area id="chongqing" alt=" chongqing " href="#" coords="294,264,320,276" shape="rect">
<area id="hebei" alt=" hebei " href="#" coords="347,174,374,186" shape="rect">
<area id="shanxi" alt=" shanxi " href="#" coords="322,186,348,198" shape="rect">
<area id="neimenggu" alt=" Inner Mongolia " href="#" coords="349,110,388,124" shape="rect">
<area id="liaoning" alt=" liaoning " href="#" coords="406,128,432,140" shape="rect">
<area id="jilin" alt=" Ji Lin " href="#" coords="427,101,454,115" shape="rect">
<area id="heilongjiang" alt=" heilongjiang " href="#" coords="424,58,464,73" shape="rect">
<area id="jiangsu" alt=" jiangsu " href="#" coords="404,224,417,250" shape="rect">
<area id="zhejiang" alt=" zhejiang " href="#" coords="413,265,427,291" shape="rect">
<area id="anhui" alt=" anhui " href="#" coords="382,236,395,263" shape="rect">
<area id="fujian" alt=" fujian " href="#" coords="399,300,413,327" shape="rect">
<area id="jiangxi" alt=" jiangxi " href="#" coords="371,286,385,313" shape="rect">
<area id="shandong" alt=" shandong " href="#" coords="373,196,399,208" shape="rect">
<area id="henan" alt=" henan " href="#" coords="337,228,364,239" shape="rect">
<area id="hubei" alt=" hubei " href="#" coords="329,258,356,271" shape="rect">
<area id="hunan" alt=" hunan " href="#" coords="325,294,352,306" shape="rect">
<area id="guangdong" alt=" guangdong " href="#" coords="356,343,382,355" shape="rect">
<area id="guangxi" alt=" guangxi " href="#" coords="302,343,328,355" shape="rect">
<area id="hainan" alt=" hainan " href="#" coords="313,398,340,411" shape="rect">
<area id="sichuan" alt="4 sichuan " href="#" coords="239,265,265,277" shape="rect">
<area id="guizhou" alt=" guizhou " href="#" coords="283,311,308,324" shape="rect">
<area id="yunnan" alt=" yunnan " href="#" coords="225,337,251,349" shape="rect">
<area id="shaanxi" alt=" shaanxi " href="#" coords="303,224,316,251" shape="rect">
<area id="gansu" alt=" gansu " href="#" coords="179,156,205,168" shape="rect">
<area id="qinghai" alt=" qinghai " href="#" coords="174,206,200,218" shape="rect">
<area id="ningxia" alt=" ningxia " href="#" coords="277,188,290,212" shape="rect">
<area id="xinjiang" alt=" xinjiang " href="#" coords="85,140,111,152" shape="rect">
<area id="xizang" alt=" Tibet " href="#" coords="87,249,113,261" shape="rect">
<area id="xianggang" alt=" Hong Kong " href="#" coords="379,358,406,370" shape="rect">
<area id="aomen" alt=" Macau " href="#" coords="349,371,375,383" shape="rect">
<area id="taiwan" alt=" Taiwan " href="#" coords="434,322,448,348" shape="rect">
</map>
</div>
</body>
</html>

That's all for this article, I hope you enjoy it


Related articles: