A
A
Anatoly2016-09-07 11:35:30
JavaScript
Anatoly, 2016-09-07 11:35:30

What is blocking the display of Google maps?

I've been fighting for the third day, but I can't track the bug.
The bottom line is simple - I decided to insert Goole maps into posts with my hands, I export all the marks from Google my map to kml and upload them to the map. The problem is that everything works on the pages, but not on the posts. I can't figure out what code is blocking the loading of the map layer
site2max.ru/tunis-otzyiv-ob-otdyihe-na-ostrove-dzh... - it doesn't work here
The code is very easy to insert. On the page:

<!--  сюда вставляется карта, здесь же заданы из какого файла подгружать точки и центр-->
<div id="stm-map" style="widht: 100%; height: 400px;" data-url="http://site2max.ru/wp-content/plugins/stm-map/Jerba_kmz.kmz" data-lat="33.801037" data-lng="10.882338" data-zoom="11"></div>
<!--  сам файл с функцией, он описан ниже-->
<script src="http://site2max.ru/wp-content/plugins/stm-map/map.js"></script>
<!--   подгрузка Google map Api -->
<script src="https://maps.googleapis.com/maps/api/js?key=MyAPIKey&amp;callback=initMap" async="" defer="defer"></script>

function initMap() {

  var mapID = document.getElementById('stm-map'); // Находим карту
  var mapData = mapID.dataset; // Берем атрибуты и переводим все в цифры

  var lat = Number( mapData.lat.valueOf() );
  var lng = Number( mapData.lng.valueOf() );
  var zoom = Number( mapData.zoom.valueOf() );
  var mapCenter = {lat: lat, lng: lng};
         
  var map = new google.maps.Map(mapID, {
    center: mapCenter,
    zoom: zoom
  });
// Подгружаем наш файл с точками
  var ctaLayer = new google.maps.KmlLayer({ 
    url: mapData.url,
    preserveViewport: true,
    map : map
  });
}

All paths are absolute, all files are opened. The problem is in the posts. What could be? Thanks in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question