[JavaScript] JS通过google api(3.0)调用google地图 →→→→→进入此内容的聊天室

来自 , 2020-11-19, 写在 JavaScript, 查看 104 次.
URL http://www.code666.cn/view/3d387d26
  1. <div id="map-canvas" style="height:400px"></div>
  2.  
  3. <script>
  4. function initialize() {
  5.  
  6.   var myLatlng = new google.maps.LatLng(52.372645,-1.27442); // Add the coordinates
  7.   var mapOptions = {
  8.     zoom: 8, // The initial zoom level when your map loads
  9.     minZoom: 6, // Minimum zoom level allowed
  10.     maxZoom: 17, // Maximum soom level allowed
  11.     center: myLatlng, // Centre the Map on your coordinates
  12.     mapTypeId: google.maps.MapTypeId.ROADMAP, // Set the type of Map
  13.     mapTypeControl:false // Disable Satellite switch
  14.   }
  15.  
  16.   var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
  17.  
  18.   // Create a variable for our marker image.
  19.   var image = new google.maps.MarkerImage("custom-heat-pin.png", null, null, null, new google.maps.Size(111,69));
  20.   // For retina compatibility, create your image at twice the resilution you specify for the size above.
  21.  
  22.   // Set the marker
  23.   var marker = new google.maps.Marker({
  24.       position: myLatlng, // Position to your coordinates.
  25.       // animation:google.maps.Animation.BOUNCE, // Enable for the bouncing marker animation
  26.       icon:image, //use our image as the marker
  27.       map: map, // assign the market to our map
  28.       title: 'Click to visit our company on Google Places' // Marker ALT Text
  29.   });
  30.  
  31.     google.maps.event.addListener(marker, 'click', function() {
  32.             window.location='http://www.creare.co.uk/'; // URL to Link Market to (i.e Google Places Listing)
  33.         });
  34.  
  35.     }
  36.  
  37. google.maps.event.addDomListener(window, 'load', initialize);
  38.  
  39. </script>
  40. //javascript/8229

回复 "JS通过google api(3.0)调用google地图"

这儿你可以回复上面这条便签

captcha