Google Map InfoWindow est trop large
-
07-07-2019 - |
Question
En cliquant sur un marqueur, j'ouvre une info-fenêtre sur une carte Google.
Le code est comme ceci:
var point =
new GLatLng(
mPointSet.points[i].lat,
mPointSet.points[i].long);
var marker = new GMarker(point);
function createMarker(marker, message)
{
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(
$("#marker-popup-template").html());
});
}
createMarker(marker);
mBigMap.addOverlay(marker);
Le problème est que, même si la largeur d’InfoWindow a été remplie, l’InfoWindow still reste trop large, autour de 400 px.
Y a-t-il un moyen de le réduire?
La solution
Essayez maxWidth .
marker.openInfoWindowHtml(
$("#marker-popup-template").html(),
{ maxWidth: 400 }
);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow