2012-03-04 3 views
1

J'utilise http://code.google.com/p/jquery-ui-map/Comment ajouter le marqueur sur la carte google en utilisant jquery-ui-carte

HTML:

<div id="map_canvas" style="width: 100%; height:400px;" latitude="123456" longitude="123456">Loading Map</div> 

jQuery:

$(function() { 
     $('#map_canvas').gmap({ 
      'center': new google.maps.LatLng($('#map_canvas').attr('latitude'),$('#map_canvas').attr('longitude')), 
      'zoom': 13 
     }); 
    }); 

Il fonctionne bien mais je suis incapable d'ajouter un marqueur. J'ai essayé beaucoup d'option dans la documentation mais incapable de placer le marqueur.

Une idée?

Merci

Répondre

2

et ce que j'ai trouvé:

http://code.google.com/apis/maps/documentation/javascript/overlays.html#MarkerAnimations

// Google Maps 
function GoogleMaps() { 

    var latitude = $("#map_canvas").attr('latitude'); 
    var longitude = $("#map_canvas").attr('longitude'); 

    var location = new google.maps.LatLng(latitude, longitude); 
    var marker; 
    var map; 

    var mapOptions = { 
      zoom: 13, 
      mapTypeId: google.maps.MapTypeId.ROADMAP, 
      center: location 
    }; 

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); 

    marker = new google.maps.Marker({ 
     map:map, 
     animation: google.maps.Animation.DROP, 
     position: location 
    }); 

} 

travail maintenant

Questions connexes