2010-03-29 6 views
2

La documentation de l'API m'a donné l'espoir hier soir avec "bindInfoWindowHtml".
Mais il ne semble pas remplacer le InfoWindow par défaut, même si vous fournissez votre propre classe, etc.API Google Maps: V2: infowindow personnalisé avec bindInfoWindowHtml

J'ai essayé d'utiliser d'autres idées comme le labeledmarker. Mais il ne supporte pas les marqueurs draggables. Par conséquent, je ne peux pas l'utiliser dans mon application.

Voici l'exemple de code qui affiche les informations. fenêtre à l'intérieur, la bulle d'origine. N'existe-t-il pas un moyen de surcharger cette fenêtre aussi!

`

<style type="text/css"> 
    .infoWindowCustomClass 
    { 
     width: 500px; 
     height: 500px; 
     background-color: #CAEE96; 
     color: #666; 
    } 
</style> 
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
<title>Google Maps JavaScript API Example</title> 
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key="" type="text/javascript"></script> 
<script type="text/javascript"> 

function load() { 
    if (GBrowserIsCompatible()) 
    { 
     // Create our "tiny" marker icon 
     var blueIcon = new GIcon(G_DEFAULT_ICON); 
     blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png"; 

     // Set up our GMarkerOptions object 
     markerOptions = { icon:blueIcon }; 

     var map = new GMap2(document.getElementById("map")); 
     map.setCenter(new GLatLng(33.968064,-83.377047), 13); 

     markerOptions.title = "fart"; 
     var point = new GLatLng(33.968064,-83.377047); 
     var marker = new GMarker(point); 
     var tempName = document.getElementById("infoWindowCustom"); 
     marker.bindInfoWindowHtml(tempName); 
     map.addOverlay(marker); 
    } 
} 

</script>` 

Et voici la DIV -

<DIV id="infoWindowCustom" name="infoWindowCustom" class="infoWindowCustomClass">
Name : <TEXTAREA NAME="nameID" ID="nameID" ROWS="2" COLS="25"></TEXTAREA>
Comments : <TEXTAREA NAME="commentsID" ID="commentsID" ROWS="4" COLS="25"></TEXTAREA>
</DIV>

Répondre

1

a résolu le problème comme ci-dessous -

lieu de le lier comme ci-dessus, je prends le lang/lats et lancer un div à cet endroit.
Cela semble fonctionner très bien.