Integrate a google map javascript API into blogger

社会主义新天地 提交于 2019-12-13 07:52:51

问题


I'm pulling my hair with Blogger and Google Maps API.

This is what I've done :

In the Template editor I added in the customize->Advanced->Add your CSS :

#map-canvas {
    height: 100%;
    margin: 0px;
    padding: 0px
  }

Then in the Header of the template I added just before the </head>:

<script src='http://maps.googleapis.com/maps/api/js?key=AIzaSyAXprv_TXEju4E-phldszJrt2VNbxfIMkU' type='text/javascript'> </script>

And Finally I tried to use the Right Bar widget HTML/Javascript and past in the HTML editor :

<script type="text/javascript">
  function initialize() {
    var mapOptions = {
      center: { lat: -34.397, lng: 150.644},
      zoom: 8
    };
    var map = new google.maps.Map(document.getElementById('map-canvas'),
        mapOptions);
  }
  google.maps.event.addDomListener(window, 'load', initialize);
</script>

You can see the result here :

http://f4eor.blogspot.com

Nothing works but the entire code works well in a simple HTML page created by notepad on my computer.

Thanks for your Help.


回答1:


Use a fixed height (e.g. height: 150px;)



来源:https://stackoverflow.com/questions/31294729/integrate-a-google-map-javascript-api-into-blogger

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