<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jquery地图热点效果-鼠标经过弹出提示信息</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script src="JS/jquery-1.8.0.min.js" type="text/javascript"></script>
<style type="text/css">
.map img
{
width: 496px;
height: 415px;
}
.mapDiv
{
width: 140px;
height: 61px;
padding: 5px;
color: #369;
background: url('Images/dialge.gif') no-repeat;
position: absolute;
display: none;
word-break: break-all;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$("area").each(function () {
var $x = -55;
var $y = -80;
var name = $(this).attr("alt");
$(this).mouseover(function (e) {
var strall = [];
strall = $(this).attr("coords").split(",");
var x = parseInt(strall[0]);
var y = parseInt(strall[3]);
var index_num = $(this).index();
var dom = "<div class='mapDiv'><p>提示消息<span class='name'></span><span class='num'></span></p></div>";
$("body").append(dom);
$(".name").text(name);
$(".num").text(index_num)
$(".mapDiv").css({
left: (x + $x) + "px",
top: (y + $y) + "px" }).show();
}).mouseout(function () {
$(".mapDiv").remove();
}).mousemove(function (e) {
$(".mapDiv").css({
left: (x + $x) + "px",
top: (y + $y) + "px"
})
});
});
//first load
show();
//random
setInterval(show, 3000); // 注意函数名没有引号和括弧
}); function show() {
var area = $("area");
var random = getRandom(area.length);
$(area[random]).trigger("mouseover");
} function getRandom(n) { return Math.floor(Math.random() * n + 1) }
</script>
</head>
<body>
<div class="map">
<img border="0" usemap="#Map" src="data:images/1544302yufceen0c3nbjzu.png" />
<map name="Map" id="Map">
<area id="beijing" alt="北京" href="forum.php?gid=1" coords="354,140,380,153" shape="rect">
<area id="shanghai" alt="上海" href="forum.php?gid=3" coords="434,246,462,259" shape="rect">
<area id="tianjin" alt="天津" href="forum.php?gid=2" coords="382,168,408,180" shape="rect">
<area id="chongqing" alt="重庆" href="forum.php?gid=4" coords="294,264,320,276" shape="rect">
<area id="hebei" alt="河北" href="forum.php?gid=5" coords="347,174,374,186" shape="rect">
<area id="shanxi" alt="山西" href="forum.php?gid=6" coords="322,186,348,198" shape="rect">
<area id="neimenggu" alt="内蒙古" href="forum.php?gid=7" coords="349,110,388,124" shape="rect">
<area id="liaoning" alt="辽宁" href="forum.php?gid=8" coords="406,128,432,140" shape="rect">
<area id="jilin" alt="吉林" href="forum.php?gid=9" coords="427,101,454,115" shape="rect">
<area id="heilongjiang" alt="黑龙江" href="forum.php?gid=10" coords="424,58,464,73" shape="rect">
<area id="jiangsu" alt="江苏" href="forum.php?gid=11" coords="404,224,417,250" shape="rect">
<area id="zhejiang" alt="浙江" href="forum.php?gid=12" coords="413,265,427,291" shape="rect">
<area id="anhui" alt="安徽" href="forum.php?gid=13" coords="382,236,395,263" shape="rect">
<area id="fujian" alt="福建" href="forum.php?gid=14" coords="399,300,413,327" shape="rect">
<area id="jiangxi" alt="江西" href="forum.php?gid=15" coords="371,286,385,313" shape="rect">
<area id="shandong" alt="山东" href="forum.php?gid=16" coords="373,196,399,208" shape="rect">
<area id="henan" alt="河南" href="forum.php?gid=17" coords="337,228,364,239" shape="rect">
<area id="hubei" alt="湖北" href="forum.php?gid=18" coords="329,258,356,271" shape="rect">
<area id="hunan" alt="湖南" href="forum.php?gid=19" coords="325,294,352,306" shape="rect">
<area id="guangdong" alt="广东" href="forum.php?gid=20" coords="356,343,382,355" shape="rect">
<area id="guangxi" alt="广西" href="forum.php?gid=21" coords="302,343,328,355" shape="rect">
<area id="hainan" alt="海南" href="forum.php?gid=22" coords="313,398,340,411" shape="rect">
<area id="sichuan" alt="四川" href="forum.php?gid=23" coords="239,265,265,277" shape="rect">
<area id="guizhou" alt="贵州" href="forum.php?gid=24" coords="283,311,308,324" shape="rect">
<area id="yunnan" alt="云南" href="forum.php?gid=25" coords="225,337,251,349" shape="rect">
<area id="shaanxi" alt="陕西" href="forum.php?gid=26" coords="303,224,316,251" shape="rect">
<area id="gansu" alt="甘肃" href="forum.php?gid=27" coords="179,156,205,168" shape="rect">
<area id="qinghai" alt="青海" href="forum.php?gid=28" coords="174,206,200,218" shape="rect">
<area id="ningxia" alt="宁夏" href="forum.php?gid=29" coords="277,188,290,212" shape="rect">
<area id="xinjiang" alt="新疆" href="forum.php?gid=30" coords="85,140,111,152" shape="rect">
<area id="xizang" alt="西藏" href="forum.php?gid=31" coords="87,249,113,261" shape="rect">
<area id="xianggang" alt="香港" href="forum.php?gid=32" coords="379,358,406,370" shape="rect">
<area id="aomen" alt="澳门" href="forum.php?gid=33" coords="349,371,375,383" shape="rect">
<area id="taiwan" alt="台湾" href="forum.php?gid=34" coords="434,322,448,348" shape="rect">
</map>
</div>
</body>
</html>

Jquery地图热点效果-鼠标经过弹出提示信息的更多相关文章

  1. jQuery地图热点效应-后在弹出的提示鼠标层信息

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  2. Jquery使用mouseenter和mouseleave实现鼠标经过弹出层且可以点击

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Jquery使用mousee ...

  3. 如何不使用js实现鼠标hover弹出菜单效果

    最近看到很多同学在实现鼠标hover弹出菜单的效果时都是用的js代码去实现的,默认给弹出隐藏掉,通过js事件绑定动态的显/隐弹出菜单元素. <ul> <li>主页</li ...

  4. jquery鼠标经过弹出层写法

    jquery鼠标经过弹出层写法<pre><div class="navitem"><a href="/index.php?c=news&am ...

  5. jQuery弹出提示信息简洁版(自动消失)

    之前看了有一些现成的blockUI.Boxy.tipswindow等的jQuery弹出层插件,可是我的要求并不高,只需要在保存后弹出提示信息即可,至于复杂点的弹出层-可以编辑的,我是直接用bootst ...

  6. 纯css实现鼠标感应弹出二级菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. SVN 安装后右键出现点击鼠标右键弹出错误提示:CrashHandler initialization error

    SVN 安装后右键出现点击鼠标右键弹出错误提示:CrashHandler initialization error 原因是目标文件夹中缺少SendRpt.exe文件 解决方案:找svn是好的的同事将b ...

  8. jQuery弹出提示信息自动消失简洁版

    // 在bootstrap中可以,可以使用如下方式实现弹出提示信息自动消失,如果没有使用bootstrap框架,可以自定义样式 //tip是提示信息,type:'success'是成功信息,'dang ...

  9. Bootstrap历练实例:弹出提示信息的样式按钮

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

随机推荐

  1. 【集美大学1411_助教博客】团队作业2——需求分析&原型设计 成绩

    首先要向各位同学道歉,最近助教的工作较多,并且伴随着频繁的出差,评论博客和评分都不及时,以致于同学们都没有得到反馈,在此我要表示歉意.其次,对于第二次团队作业,有两个团队没有提交到班级博客中但按时完成 ...

  2. 团队作业八—第二次团队冲刺(Beta版本) 第 2 天

    一.每个人的工作 (1) 昨天已完成的工作 昨天的工作主要是一些界面的设计,我们顺利完成了复杂模式题目数目界面.复杂模式做题界面.结果统计界面的具体代码编写,和一些细节的完善.还有日常冲刺博客的编辑. ...

  3. 201521123040《Java程序设计》第7周学习总结

    1. 本周学习总结 以你喜欢的方式(思维导图或其他)归纳总结集合相关内容. 参考资料: XMind 2. 书面作业 1.ArrayList代码分析 1.1 解释ArrayList的contains源代 ...

  4. 201521123106 《Java程序设计》第13周学习总结

    1. 本周学习总结 以你喜欢的方式(思维导图.OneNote或其他)归纳总结多网络相关内容. 2. 书面作业 1. 网络基础 1.1 比较ping www.baidu.com与ping cec.jmu ...

  5. Elipse中发布一个Maven项目到Tomcat

    对于maven初学者的我,经常遇到一个问题就是,maven项目创建成功后,本来已经添加了jar的依赖,但是发布到Tomcat中就是没有jar包存在, 启动Tomcat总是报没有找到jar包,可项目结构 ...

  6. 由throw new Error() 引发的探讨

    问题复现 在工作时遇到了需要抛出异常并且需要自己捕获处理的地方,于是在抛出的地方写下 function parseExcel(con) { try { // doSomething } catch ( ...

  7. ios开发——实用技术篇&三维旋转动画

    实现三位旋转动画的方法有很多种,这里介绍三种 一:UIView 1 [UIView animateWithDuration:1.0 animations:^{ 2 self.iconView.laye ...

  8. GCD之死锁

    GCD相当好用,但用不好就会死锁,始终要记着这样一句秘籍: 不要在串行队列放dispatch_sync.dispatch_apply 下面看几个例子 1 2 3 4 5 6 7 8 9 10 11 1 ...

  9. Redis常见的应用场景解析

    Redis是一个key-value存储系统,现在在各种系统中的使用越来越多,大部分情况下是因为其高性能的特性,被当做缓存使用,这里介绍下Redis经常遇到的使用场景. Redis特性 一个产品的使用场 ...

  10. C#单例测试(懒汉式双锁保证线程安全)

    单例模式的概念 单例模式的意思就是只有一个实例.单例模式确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例.这个类称为单例类. 关键点: 这个类只有一个实例,这是最基本的 它必须自行创建 ...