简体   繁体   中英

Google Maps not loading

I am using this JavaScript code to my sample site and I am including a Google Map there, however the Map does not load when the page loads.

UPDATE - Also, I've noticed if I leave the web page open for a long period of time some parts of the google map get loaded.

Is this an error with the code I've written or some form of a lag.

Any kind of help is appreciated

HTML

<head>
    <script src="js/gmaps.js"/></script>

    </head>

    <body>
        <section id="properties" class="container">
            <article id="prop1">
                <div id="tabs">
                    <ul>
                        <li>
                            <a href="#map">Location</a>
                        </li>
                    </ul>
                    <div id="map"></div>
                    </div>
            </article>
            </body>
            </html>

JAVASCRIPT

<script>    
       GMaps({//maps UI
    el: '#map', 
    lat: 52.97,
    lng: -2.44
  });
            </script>

Try to replace el to div like this :

$(document).ready(function() {
    GMaps({//maps UI
        div: '#map', 
        lat: 52.97,
        lng: -2.44
    });
});

Just check the documentation : https://hpneo.github.io/gmaps/examples/basic.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM