<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="base.css" />
<script type="text/javascript" src="jquery-1.10.1.min.js" ></script>
<style>
.fix-center{ height:120px; width:219px; background:#f60; display:none; position:fixed; }
</style>
</head>
<body>
<div style="height:10000px;"></div>
<div id="fixCenter" class="fix-center">
<img src="fixCenter.jpg" width="219" height="120" usemap="#fixCenterMap">
<map name="fixCenterMap" id="fixCenterMap">
<area shape="rect" coords="175,0,219,30" href="javascript:void(0);" id="closeFixCenter" />
<area shape="rect" coords="0,30,219,94" href ="###1" target="_blank" />
<area shape="rect" coords="0,94,219,120" href ="###2" target="_blank" />
</map>
</div>
<script>
$(function(){
fixCenter();
});
function fixCenter(){
var fid = $("#fixCenter");
//获取当前窗口的高度
var h = $(window).height();
//获取当前窗口的宽度
var w = $(window).width();
//计算要定位左侧距离
var l = (w/2) - parseInt(fid.css("width")) / 2;
//计算要定位上侧距离
var t = (h/2) - parseInt(fid.css("height")) / 2;
fid.css({"left":(l) + "px", "top": (t) + "px" }).fadeIn(600);
$("#closeFixCenter").click(function(){
fid.fadeOut(600).delay(3000).fadeIn(600);
});
$(window).resize(function(){
h = $(window).height();
w = $(window).width();
l = (w/2) - parseInt(fid.css("width")) / 2;
t = (h/2) - parseInt(fid.css("height")) / 2;
fid.css({"left":(l) + "px", "top": (t) + "px" });
});
}
</script>
</body>
</html>
效果图: