My component has the functionality to load google map (Maps API version 3 with valid API key).
My infowindow above the marker stops working. One week back everything was smooth and working good.
Here is the code:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<API-KEY>&sensor=false"></script>
<script type="text/javascript">
map = new google.maps.Map(document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.TOP_RIGHT
},
panControl: true,
panControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.LEFT_TOP
}
});
var marker = new google.maps.Marker({
map: map,
draggable:true,
position: results[0].geometry.location
});
var infowindow = new google.maps.InfoWindow();
infowindow.setContent("Lorem Ipsum");
infowindow.open(map, marker); // On this line the problem is occurring
</script>
After investigating I noticed that it is not working due to mootools.js (version: 1.11) file. I cannot remove mootools files as it is breaking the default behaviour of the joomla.
The google map infowindow is working fine when I moved my code to non joomla project.
Below is the error which I am getting in the console log. Sharing first 2 lines of the error because it is big and it contains the API key.
Uncaught (in promise) Object { message: "View: element invalid: not an instance of Element", name: "InvalidValueError", stack: "ie@https://maps.googleapis.com/maps/api/js?key=......etc
Any help is very much appreciated. Thanks
map
andmarker
being defined? Can you share the code for that?