Google maps api 3 Googlemap v3信息窗口显示隐藏div后自动调整大小

Google maps api 3 Googlemap v3信息窗口显示隐藏div后自动调整大小,google-maps-api-3,infowindow,Google Maps Api 3,Infowindow,我正在用谷歌地图写一个网页&我遇到了一些麻烦 我有一个包含隐藏div的信息窗口,我想在单击信息窗口中的按钮时显示它。但问题是,当我显示隐藏的div时,infoWindow的大小不会自动适应新内容 你能给我一些建议来解决这个问题吗?非常感谢:- 这是我的js: function redraw() { var cmt = $("#bodyContent"); cmt.show(); } var myLatlng = new google.maps.LatLng(-25.363882

我正在用谷歌地图写一个网页&我遇到了一些麻烦

我有一个包含隐藏div的信息窗口,我想在单击信息窗口中的按钮时显示它。但问题是,当我显示隐藏的div时,infoWindow的大小不会自动适应新内容

你能给我一些建议来解决这个问题吗?非常感谢:-

这是我的js:

function redraw() {
    var cmt = $("#bodyContent");
    cmt.show();
}

var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
    zoom: 4,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}

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

var contentString = '<div id="content">'+
                    '<h2 id="firstHeading" class="firstHeading">Uluru</h2>'+
                    '<input type="button" value="Test" onclick="redraw()" />' +
                    '<div id="bodyContent" class="test">'+
                    '<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
                    'sandstone rock formation in the southern part of the '+
                    'Northern Territory, central Australia. It lies 335 km (208 mi) '+
                    'south west of the nearest large town, Alice Springs; 450 km '+
                    '(280 mi) by road. Kata Tjuta and Uluru are the two major '+
                    'features of the Uluru - Kata Tjuta National Park. Uluru is '+
                    'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
                    'Aboriginal people of the area. It has many springs, waterholes, '+
                    'rock caves and ancient paintings. Uluru is listed as a World '+
                    'Heritage Site.</p>'+
                    '</div>'+
                    '</div>';

infowindow = new google.maps.InfoWindow({
                    maxWidth: 300,
                    content: contentString
                 });

var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title:"Uluru (Ayers Rock)"
                 });

google.maps.event.addListener(marker, 'click', function() {
                    infowindow.open(map,marker);
                 });