Map I am developing for recently lost functionality

I am a web developer at my university who is currently working on our map. It can be found here . Buttons appear under each heading when you click on the heading, and when you click on the buttons (on the map or in the sidebar), the info box should appear with a short snippet of location, usually with a photo next to it. Unfortunately, in the last two months, all info windows have stopped showing. I tried to make sure our jquery was up to date and ran the custom javascript we made to see if there were any significant changes (best I can tell they're not there). I am wondering if there have been recent updates to the Google Maps API that might break this. I'm going through the script trying to identify potential problem areas, but dry. Any ideas?

(edit) I'll post the relevant code to infowindows, otherwise it will only be a headache for everyone.

for (var i in data.d.Buildings) {
    var color = categories[4].Color.substring(1);
    var myLatLng = new google.maps.LatLng(data.d.Buildings[i].Latitude, data.d.Buildings[i].Longitude);
    var image = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + data.d.Buildings[i].LegendKey + '|' + color + '|ffffff';
    categoryItems['search'][i].marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image,
        pushpinInfo: data.d.Buildings[i]
    });

    google.maps.event.addListener(categoryItems['search'][i].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });

    addPushpinToMenu(categoryItems['search'][i], 'search', image);
    count++;
}

      


    if (data.d.ParkingLots[i].Name != null && data.d.ParkingLots[i].Name != "") {
        google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
            infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
            infowindow.setPosition(this.centerLatLng);
            infowindow.open(map);
        });
    }

      


    google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });

      


        if (data.d[i].ParkingLots[a].Name != null && data.d[i].ParkingLots[a].Name != "") {
            google.maps.event.addListener(categoryItems[6][i].ParkingLots[a].marker, 'click', function () {
                infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
                infowindow.setPosition(this.centerLatLng);
                infowindow.open(map);
            });
        }

      


    google.maps.event.addListener(categoryItems[data.d[0].TypeID][i].marker, 'click', function () {
        infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Name + '" />' : '') + this.pushpinInfo.Description + '</div>';
        infowindow.open(map, this);
    });

      

+3


source to share


1 answer


The problem is not related to the jQuery version, it is the Maps-API version that breaks it (since 3.10)

You are setting the infoWindows content property directly, which seems unfortunate since 3.10.

You can either fix the script (use it instead setContent()

) or specify the API version:



https://maps.googleapis.com/maps/api/js?v=3.9&sensor=false 

      

(but I would suggest to fix it)

+2


source







All Articles