1
내 Google지도에서 작동하는 데 문제가 있습니다. 모든 마커가 올바른 좌표를 가리키고 있지만지도에 표시 될 때 자동 확대/축소가 제대로 조정되지 않습니다. 누군가 내 제발 var bounds 도와주세요.var bounds가 내 Google지도에서 작동하지 않습니다.
var companyLocale = new google.maps.LatLng(33.206060, -117.111951);
var noGeo = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
function initialize() {
var myOptions = {
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
<!-------------------------------USER MARKERS------------------->
var usericon = new google.maps.MarkerImage(
'images/userimage.png',
new google.maps.Size(48,48),
new google.maps.Point(0,0),
new google.maps.Point(24,48)
);
var usershadow = new google.maps.MarkerImage(
'images/usershadow.png',
new google.maps.Size(76,48),
new google.maps.Point(0,0),
new google.maps.Point(24,48)
);
<!-------------------------------COMP MARKERS------------------->
var icon = new google.maps.MarkerImage(
'images/image.png',
new google.maps.Size(48,48),
new google.maps.Point(0,0),
new google.maps.Point(24,48)
);
var shadow = new google.maps.MarkerImage(
'images/shadow.png',
new google.maps.Size(76,48),
new google.maps.Point(0,0),
new google.maps.Point(24,48)
);
function toggleBounce() {
if (marker.getAnimation() != null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// Safari supports the W3C Geolocation method
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
var bounds = new google.maps.LatLngBounds();
var placeMarker = new google.maps.Marker({
position: initialLocation,
icon: usericon,
shadow: usershadow,
animation: google.maps.Animation.DROP,
map: map
});
map.setCenter(initialLocation);
var bounds = new google.maps.LatLngBounds();
var Marker = new google.maps.Marker({
position: companyLocale,
icon: icon,
shadow: shadow,
animation: google.maps.Animation.DROP,
map: map
});
google.maps.event.addListener(Marker, 'click', function() {
window.location = "main-export/main.html";
});
google.maps.event.addListener(placeMarker, 'click', function() {
window.location = "main-export/loyalty.html";
});
}, function() {
handleNoGeolocation(browserSupportFlag);
});
} else {
// Browser doesn't support Geolocation
handleNoGeolocation();
}
function handleNoGeolocation() {
initialLocation = noGeo;
map.setCenter(initialLocation);
}
bounds.extend(myLatLng);
map.fitBounds(bounds);
}
안녕과
bounds.extend(myLatLng);
교체 누군가가 내가 잘못 뭐하는 거지에 대한 통찰력을 가질 것 기대했다. 앞에서 언급했듯이, 나는 var 바운드가 제대로 작동하도록해야합니다. – need2nobasis