Myself and others have complained that if a KML feature has a lot of
text then part of that text  spills out the bottom of the infowindow
when that feature is clicked.  Today I discovered a simple solution.

1.  (This step is optional)  Make a single API infowindow that  you
will reuse by updating its contents and location.

2.  In your KML options - suppress the standard infowindow.  Since
that one cannot do scroll bars, tell it to keep quiet.

3.  Code snip (you will need to tweak the variable names):

          google.maps.event.addListenerOnce(masu.kml_layer,
'metadata_changed', function(kmlEvent) {
            // Get the name and description for the KML FILE
            masu.kml_metadata = masu.kml_layer.getMetadata();
            // Listen for a click on the KML
            google.maps.event.addListener(masu.kml_layer, 'click',
function(kmlEvent) {
              masu.infowindow.close();
              masu.name = "";
              masu.description = "";
              masu.name = kmlEvent.featureData.name;
              masu.description = kmlEvent.featureData.description;
              if (masu.name == undefined || masu.name == "?") {
                masu.name = "";
              }
              if (masu.description == undefined || masu.description ==
"?") {
                masu.description = "";
              }
              // Display name and description for the item that was
clicked
              temp_position = kmlEvent.latLng;
              masu.msg = "<div style='margin-right:15px;'>" +
masu.name + "<br><br>" + masu.description + "</div>";
              masu.infowindow.setContent(masu.msg);
              masu.infowindow.setPosition(temp_position);
              masu.infowindow.open(masu.map);
            });
          });

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to