0

我在我的网站中实现了一个风格化的谷歌地图,当我在 iphone 上查看页面时,它会锁定网页的缩放级别。“地图”仍然可以“捏”缩放,但网页不是。我不知道如何打开网页和地图的捏缩放?在此先感谢任何帮助者!这是该页面的链接 - http://esdaledesigns.com/contact.php

   <script type="text/javascript">
      function initialize() {


          // Create an array of styles.
  var styles = [
  {
    "stylers": [
      { "hue": "#ff6e00" },
      { "saturation": -67 }
    ]
    }
  ];

  // Create a new StyledMapType object, passing it the array of styles,
  // as well as the name to be displayed on the map type control.
  var styledMap = new google.maps.StyledMapType(styles,
    {name: "The Stockwell"});

  // Create a map object, and include the MapTypeId to add
  // to the map type control.
  var mapOptions = {
    zoom: 16,
    center: new google.maps.LatLng(51.890488, 0.899154),
    mapTypeControlOptions: {
      mapTypeIds: ['map_style'], 
    },
  };
  var map = new google.maps.Map(document.getElementById('map_canvas'),
    mapOptions);

  var myLatlng = new google.maps.LatLng(51.890488, 0.899154);
  var marker = new google.maps.Marker({
      position: myLatlng,
      animation: google.maps.Animation.DROP,
      map: map,
      title:"The Stockwell"
  });

  //information
  var contentString = '<div id="content">'+
    '<div id="siteNotice">'+
    '</div>'+
    '<h2 id="firstHeading" class="firstHeading">The Stockwell Colchester</h2>'+
    '<div id="bodyContent">'+
    '<p>THE STOCKWELL<br />18 WEST STOCKWELL STREET<br />COLCHESTER<br />ESSEX<br />CO1 1HN<br /></p>'+
    '</div>'+
    '</div>';

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


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


//Associate the styled map with the MapTypeId and set it to display.
  map.mapTypes.set('map_style', styledMap);
  map.setMapTypeId('map_style');
}
    </script>
4

1 回答 1

0

好的,解决了……

就是在我发布的脚本上方几行的这段代码,就在 google api 键的上方。 <meta name="viewport" content="initial-scale=2.0, user-scalable=no" />我将 user-scalable 更改为“yes”,将 initial-scale 更改为“0.5”,一切正常。希望这对其他人有帮助。

于 2012-10-13T18:40:33.243 回答