Question

Je viens de découvrir la bibliothèque Markermanager et j'essaie de l'utiliser pour ma carte.

Fondamentalement, voici la partie qui ne fonctionne pas:

google.maps.event.addDomListener(window, 'load', initialize);

//-- Function called when the body is loaded --//
function initialize() {
var myOptions = {
    minZoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

    var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(48.81,2.249), new google.maps.LatLng(48.903,2.416));
    map.fitBounds(bounds);


    mmng = new MarkerManager(map);

    google.maps.event.addListener(mmng, 'loaded', function() {
        var marker = new google.maps.Marker({
    position: initial_center,
    icon: "img/m1.png",
    title: "GO"
    });

    mmng.addMarkers(new Array(marker));
    alert("test1");
    mmng.refresh();
    alert("test2");
});

J'obtiens l'alerte "test1" mais pas le "test2" et le code après cela n'est pas exécuté ...

On dirait que la méthode de rafraîchissement ne fonctionnera pas ... Avez-vous une explication?

Thomas

Edit: ok c'est résolu que c'était juste que la bibliothèque de Markermanager n'a pas encore été chargée quand je l'ai utilisée ... :)

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top