주석에서 설명한대로 맵 컨트롤 자체에서 DOM에 추가 된 사용자 정의 정보 상자를 사용하는 것이 좋습니다. 이 방법으로 맵 컨트롤의 DIV 컨테이너에 국한되지 않습니다.
는 예를 들어 아래의 코드를 참조하십시오 : 당신이 할 쉽게 수있는 것은지도 통제에서 자신의 정보 상자를 관리 할 수 있으며 페이지의 상대적 위치에 따라 위치를 설정
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" charset="UTF-8" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0">
</script>
<script type="text/javascript">
var map = null;
function getMap() {
map = new Microsoft.Maps.Map(
document.getElementById('myMap'),
{
credentials: 'YOURKEY',
showCopyright: false
});
// Create the pushpin
var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(47.5, 2.75));
// Add the pushpin to the map
map.entities.push(pushpin);
// Bind the click event on the pushpin
Microsoft.Maps.Events.addHandler(pushpin, 'click', function(e) {
if (e.targetType == 'pushpin') {
var box = document.getElementById('infobox');
box.style.top = e.pageY + 'px';
box.style.left = e.pageX + 'px';
box.style.visibility = 'visible';
}
});
}
</script>
</head>
<body onload="getMap();">
<div id="container" style="position:relative;"></div>
<div id="myMap" style="position: absolute;z-index:1; width: 800px; height: 600px;">
</div>
<div id="infobox" style="float:left;z-index:2; visibility:hidden;position:absolute; width:500px; height: 300px; background-color:White; border: 1px solid #333;">Sample content for an infobox which should be larger than the map control.</div>
</body>
</html>
. 이런 식으로, 당신은 infobox가 컨트롤에 'clipped'되지 않습니다. 두 API 모두에서 작동 할 수 있습니다. –
예, 작동합니다. 마커 DOM과 opentip-works를 사용합니다. ;) –