1
Google지도를 iframe에 가운데 놓으려고합니다. 아래 코드는 iframe의 내용입니다. 마커가 프레임 중앙에 있지 않습니다.Google지도의 가운데 표식
무엇 누락?
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=MYAPIKEY&sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng('<?php echo $this->uri->segment(5); ?>', '<?php echo $this->uri->segment(4); ?>');
var myOptions = {
zoom: 8,
mapTypeControl: false,
scaleControl: false,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Hello World!"
});
}
initialize();
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
UPDATE
나는 그것이 map_canvas에 대한 고정 된 크기를 설정하는 대신 100 %를 사용하여 구입 해결했다 생각합니다. 나는 훨씬 더 잘 작동한다.
그래, 문제는 iframe 내부에 넣을 때 더 이상 가운데에 맞춰지지 않는다는 것입니다. –
@Engineer. 답변을 작성하십시오. 최선의 답변으로 선택하겠습니다. –