1

我在我的联系页面上嵌入了谷歌地图,但谷歌放大/缩小不起作用,我如何在此处添加信息框是我的链接

http://www.spheretekk.com/safari/map-lax.html

这是我的 chrome 截图

http://www.safarikidindia.com/ss.jpg

这是我的 uodated js

 < script type = "text/javascript" >

 function initialize() {
//Initalize JS after onload
var map = new google.maps.Map(document.getElementById('map_canvas'), {

    mapTypeId: google.maps.MapTypeId.ROADMAP,
});




var randomPoint0 = new google.maps.LatLng(22.59373, 72.94922);
//First Location


var marker0 = new google.maps.Marker({
    //Set up marker
    position: randomPoint0,
    map: map
});

google.maps.event.addDomListener(document.getElementById('locationid0'), 'click', //Set up DOM listener 1
function () {
    map.setZoom(13);
    map.setCenter(marker0.getPosition());

});




var randomPoint1 = new google.maps.LatLng(19.01626, 72.84019);
//First Location
var contentString = '<div id="content">' +
    '<div id="siteNotice">' +
    '</div>' +
    '<h2 id="firstHeading" class="firstHeading">Uluru</h2>' +
    '<div id="bodyContent">' +
    '<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>' +
    '<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">' +
    'http://en.wikipedia.org/w/index.php?title=Uluru</a> (last visited June 22, 2009).</p>' +
    '</div>' +
    '</div>';

var infowindow = new google.maps.InfoWindow({
    content: contentString
});

var marker1 = new google.maps.Marker({
    //Set up marker
    position: randomPoint1,
    map: map
});

google.maps.event.addDomListener(document.getElementById('city'), 'change', //Set up DOM listener 1
function () {
    map.setZoom(13);
    map.setCenter(marker1.getPosition());

});









map.setCenter(marker0.getPosition());
map.setZoom(5);
 }
 google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
 });



 < /script>

我错过了什么或做错了什么?

4

3 回答 3

2

这个问题应该是因为普遍img{max-width: 100%;}

在你的 CSS 中试试这个

.gmnoprint img {
    max-width: none; 
}
于 2014-02-25T17:08:34.270 回答
1

看起来您还没有添加控件的选项,或者至少没有添加缩放控件。

https://developers.google.com/maps/documentation/javascript/controls#Adding_Controls_to_the_Map

基于此,您似乎需要在 Initialize 之后添加它们。

于 2013-08-16T12:09:14.827 回答
0

在你的 CSS 中试试这个

.gmnoprint>* {
    left: 0;
}
于 2015-04-07T12:00:09.273 回答