custom google map add place card

耗尽温柔 提交于 2019-12-06 08:54:53

问题


i have created custom google map using php. it shows marker, location and info window.

it works fine without any issue.

i want to add place card in it. check below screenshot. How can i display Place card on my custom map.

i tried following code to display custom location.

   <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
         <script>
         var saveWidget;

         function initialize() {

     var myLatlng = new google.maps.new google.maps.LatLng(-34.397, 150.644);
          var mapOptions = {
            zoom: 4,
            center: myLatlng
          };

        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
        var contentString = '<div id="content">'+
              '<div id="siteNotice">'+
              '</div>'+
              '<h1 id="firstHeading" class="firstHeading">location</h1>'
              '</div>';

        var infowindow = new google.maps.InfoWindow({  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); });  }

        google.maps.event.addDomListener(window, 'load', initialize);
        </script>

来源:https://stackoverflow.com/questions/28763672/custom-google-map-add-place-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!