webapp에서 ajax가 포함 된 페이지 (googlemap.asp와지도)를로드합니다.Google지도가 왼쪽 상단에 작게 표시됩니다.
jquery.load가있는 div에 "googlemap.asp"를로드하고 왼쪽 상단에 작은지도 만 표시하므로 크기가 320 x 600으로 설정되지 않았습니다. div. 이렇게로드 할 때 맵을 올바르게 렌더링하지 않습니다.
하지만 "googlemap.asp"를 브라우저에서 바로로드하면 (아약스가없는 경우) 오른쪽으로 표시되므로 아약스로로드 할 때 어떻게 든 다시 채워야 할 것 같네요?
이 내가 무엇을 가지고 :
<div id="map_canvas" style="height:600px; width:320px;" ></div>
window.onload=googleMaploadScript();
function googleMaploadScript() {
var script =document.createElement("script");
script.type="text/javascript";
script.src="http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
}
var address1 = document.getElementById('address').value;
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(57.109577,12.286513),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
codeAddress(address1);
}
function codeAddress(address) {
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
을 내가 어떻게 든 잘못된 순서로로드 생각, 그것이 바로 렌더링되지 않았거나이 사업부는 시작에 보이지 않는 것을 할 수없는 이유 이잖아?
모든 의견을 감사드립니다.
"mapOptions"에서 높이와 너비를 설정하려고 시도했지만 작동하지 않았습니다. –
ok, mapOptins에서 높이와 너비를 설정하고 iPhone에서 작동하지만 데스크탑 사파리에서는 작동하지 않습니다. 하지만 지금은 중심에 있지 않습니다. 센터가 왼쪽 상단 구석에 있습니까? –