我只需要在地图内部或上方放置一个div(或更多),例如地图区域内的菜单,
我在加载地图时需要这个div …
CSS不能做对吗?
该div包含php代码…
最佳答案
是的,这可以通过CSS定位轻松完成.考虑以下简短示例:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps v2 API: Floating Div</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div style="position: relative;">
<div id="map_canvas" style="width: 400px; height: 300px;"></div>
<div style="position: absolute; top: 0px;
width: 100px; height: 100px; background-color: grey;">
Menu Here
</div>
</div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(38.00,-100.00),3);
</script>
</body>
</html>
屏幕截图:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。