Monaca does not show maps using googlemapsapi

Asked 2 years ago, Updated 2 years ago, 125 views

<script src="components/loader.js"></script>

If you write the above, you will not be able to view the map using the following:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  function initialize() {
    var latlng = new google.maps.LatLng (-34.397, 150.644);
    varmyOptions={
      zoom —8,
      center —latlng,
      mapTypeId—Google.maps.MapTypeId.ROADMAP
    };
    varmap = new google.maps.Map( document.getElementById("map_canvas"), myOptions);
  }
</script>

If I don't read components/loader.js, I can see the map...
This may be a very rudimentary question, but I asked because I didn't have the same question.monacax googlemapsapi, it's hard.

monaca google-maps

2022-09-30 20:17

1 Answers

I suspect that div#map_canvas has not been loaded yet when I called initialize(), but the information is too small.loader.js will include the plug-in content (jQuery, OnsenUI, and so on) and the whole initialize() call.


2022-09-30 20:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.