Map display problem

84 views
Skip to first unread message

ser...@nextep.it

unread,
Mar 16, 2018, 12:24:48 AM3/16/18
to Google Maps JavaScript API v3
Hi,
I have several problems displaying a map on my site, for a month now, when I think something change about Google Maps API (before all works fine, until version 3.29).

The page is this: http://www.emmeti.com/portal/it/default/test

I am loading API in this way, in the head of the site:

var EMT = {};

EMT.requestGoogleMapsAPI = function(callback, version, sensor) {
    if (typeof google == "object") {
        var callbackFunction = window[callback];
        if (typeof callbackFunction == "function")
            callbackFunction();
           
    } else {
        var lang = eXo.env.portal.language;
        var s = sensor || false;
        var v = version || "3.exp"
        jq.getScript(
            "https://maps.googleapis.com/maps/api/js?v="+v+"&sensor="+s+"&language="+lang+"&callback="+callback
            ,function(){}
        );
    }
}

and then, I have in body a simple Google map, buiilt in this way:

<div class="map_canvas" id="map-canvas">
    &nbsp;</div>
<div id="gmap_contatti" style="width:100%;height:440px;background:#999">

    <script type="text/javascript">
function CARAziendaContatti_initMap () {

    var uluru = {lat: -25.363, lng: 131.044};
    var    map = new google.maps.Map(document.getElementById("gmap_contatti"),  {
                  zoom: 4,
                  center: uluru
            });
   
    google.maps.event.addListener(map, 'idle', function(){

        //if(!mapLoaded){
            //jq('#gmap_contatti').trigger('mapLoaded');
            var uluru = {lat: -25.363, lng: 131.044};
            map = new google.maps.Map(document.getElementById("gmap_contatti"),  {
                  zoom: 4,
                  center: uluru
            });
            /*var marker = new google.maps.Marker({
              position: uluru,
              map: map
            });*/
       // }
    });
}

</script><script type="text/javascript">
    function setupCARAziendaContatti () {
        EMT.requestGoogleMapsAPI("CARAziendaContatti_initMap", "3.exp");
    }
    setupCARAziendaContatti();
</script></div>

How can I fix this? Is there a way to solve this?

Regards

Simone Pesavento

Reply all
Reply to author
Forward
0 new messages