Google地图标记引脚未显示

时间:2017-01-23 14:51:01

标签: javascript html google-maps google-maps-api-3

我的Google地图小部件存在问题,我的实际网站上没有显示该标记,但是当我将代码放入Codepen时显示该标记。

Codepen:

http://codepen.io/anon/pen/LxLprp

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD2X6alsV0XdrvNoB4HCEBxNn9VgQYniII"></script>
<script>
    function initialize() {
        var mapCanvas = document.getElementById('map');
        var mapOptions = {
            center: new google.maps.LatLng(51.632566, -0.175259),
            zoom: 17,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(mapCanvas, mapOptions)

        var marker = new google.maps.Marker({
            position: {lat: 51.632566, lng: -0.175259},
            map: map,
            title: 'Test'
        });

    }
    google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map" style="height: 300px; width: 300px"></div>

enter image description here

直播网站

enter image description here

有人可能知道这里有什么问题吗?控制台没有显示任何错误。

谢谢。

1 个答案:

答案 0 :(得分:0)

You can start a thread like:

    Thread thread=new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        //Do you task
                    }catch (Exception ex){
                        ex.printStackTrace();}
                }
            });
thread.start();

To stop a Thread:

   thread.join();//it will kill you thread

   //if you want to know whether your thread is alive or dead you can use
System.out.println("Thread is "+thread.isAlive());

从您的网页中删除此CSS规则,它将有效...

如果您尝试隐藏地图中的某些功能,请不要使用CSS。用地图选项来做。