I'm working in a bootstrap
theme and I'm having some trouble adding the google maps api
. The map is in a javascript
file and it is like this:
google.maps.event.addDomListener(window, 'load', init);
function init() {
var mapOptions = {
zoom: 15,
scrollwheel: false,
center: new google.maps.LatLng(41.428005, -8.674701),
styles: [
{
...
var mapElement = document.getElementById('map');
var map = new google.maps.Map(mapElement, mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(41.428005, -8.674701),
map: map,
And in html there is only this:
<section class="map">
<div id="map"></div>
</section>
How can I add the Api
key here?
Thank you.
当您在网站上添加脚本时,会将Google Maps API的密钥作为查询参数包含在URL中。
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
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.