Google Map 谷歌地圖

    <script> 
        var map;
        function initMap() {            
            var position = new google.maps.LatLng(1.539187, 103.647115),
                                
            map = new google.maps.Map(document.getElementById('map'), {
                center: position,
                zoom: 15, 
                styles: [去網站弄]                
            });
         
            var marker = new google.maps.Marker({
                position: position,
                map: map,
                animation: google.maps.Animation.DROP, // BOUNCE, DROP, lo, no              
                icon: 'http://www.zoominn.com.my/i/ModuleMap_icon.png'                 
            });
            marker.addListener('click', function () {
                var ttc = document.getElementById('mapContent').cloneNode(true);
                var infoWindow = new google.maps.InfoWindow;
                infoWindow.setPosition(position);
                infoWindow.setContent(ttc);  //can put element but won't auto clone 哦
                infoWindow.open(map);                    
            });          
        }

        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.defer = true;
        script.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyDzbTtAijGTrGdYxbU3FGuxnwwO3Vkmixg&callback=initMap'
        document.body.appendChild(script);

    </script>
    @*<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDzbTtAijGTrGdYxbU3FGuxnwwO3Vkmixg&callback=initMap" async defer></script>*@

refer : 

https://mapstyle.withgoogle.com/    (弄 style 的)

https://developers.google.com/maps/ (官網)

 

關鍵詞:script maps google map var infowindow position com new document

相關推薦:

navigator和地理定位

Google Map v2 Custom Infowindow with two clickable buttons or ImageView

Strange prototype-jquery problem when using a google map

景點地圖開發實戰

vue2.x使用百度地圖

百度地圖API 新增標籤

HTML5定位功能,實現在百度地圖上定位

圖形查詢屬性(IdentifyTask實現查詢)//查詢本地服務

使用JS獲取當前地理位置方法彙總(如用谷歌介面,會出再以上報錯,必須申請金鑰並設定接受伺服器IP!!!)

百度地圖api使用