Salve ho un problema con il circle di google map , questo il codice :
codice:
<script src="http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
function init_map() {
var myOptions = {
zoom: 16,
center: new google.maps.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions);
marker = new google.maps.Marker({
position: new google.maps.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>)
});
// Add circle overlay and bind to marker
var circle = new google.maps.Circle({
map: map,
radius: 160,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.05,
// 10 miles in metres
// fillColor: '#AA0000'
});
circle.bindTo('center', marker, 'position');
infowindow = new google.maps.InfoWindow({
content: "<?php echo $formatted_address; ?>"
});
google.maps.event.addListener(marker, "click", function () {
infowindow.open(map, marker);
});
infowindow.open(map, marker);
}
google.maps.event.addDomListener(window, 'load', init_map);
</script>
<?php
// if unable to geocode the address
}else{
echo "No map found.";
}
?>
I dati sono inseriti correttamente in precedenza , però la mappa appare solo se premo il pulsnte ispeziona elemento di chrome o analizza elemento di firefox .
Quale potrebbe essere il motivo ?