Taylor Gomez
Taylor Gomez

Reputation: 330

Use of gmaps.js (google maps api )

I want use of gmaps.js and i tried as following code but this don't work. what do to do?

Example: http://jsfiddle.net/65tza8h7/

<div id="map"></div>

#map {
      width: 400px;
      height: 400px;
    }

var map = new GMaps({
      el: '#map',
      lat: -12.043333,
      lng: -77.028333
    });

Upvotes: 0

Views: 388

Answers (1)

Nicolae Olariu
Nicolae Olariu

Reputation: 2555

You have to load the Google Maps API js file first and then the gmaps.js. Have a look at this updated fiddle.

<script type='text/javascript' src="https://maps.google.com/maps/api/js?sensor=true"></script>
<script type='text/javascript' src="https://hpneo.github.io/gmaps/gmaps.js"></script>

In your post, the gmaps.js file was loading first but the browser wasn't able to find any of the required methods from the Google Maps API file. You can read more on Load and Execute order of scripts at the link given.

Upvotes: 1

Related Questions