How can I reinit or clear google maps infowindow cache - javascript

I have created a nested carousel inside of a gmaps infowindow, the top level carousel keeps track of all of the nested slides. It works perfect on the first infowindow instance, but when I click another marker and when the next infowindow opens the count is based off of the previous infowindow..
is there a way to destory the last instance of the infowindow?

Fixed the issue, had to change the event listener to just addListenerOnce.

Related

some portion of Map disappears

I am using Google map API Version 3 with jQuery mobile. I created marker on map then also 1 marker for current position and then I want to print path between two points like current point and some specific spots. For doing this I generated popup with list of fixed spots user can select any and processed after popup application back to map and tries to plot a route on map but in Chrome the map view is destroyed and shown just in corner. Only in Firefox no issue arise.
This usually happens when you load your map inside a hidden element or you change your elements properties after loading a map inside it. If that is the case
google.maps.event.addListenerOnce(map, 'idle', function() {
google.maps.event.trigger(map, 'resize');
});
this might solve your problem.

Map touch/click only firing after map tiles have rendered

I am working with Leaflet JS to build a map with clustered markers on a large touch screen.
The problem we are having is that when a user clicks the marker the event does not get fired until all the tiles have loaded.
Is there a way we can still trigger the map click even though all tiles have not yet been loaded.

How to bind div position with google map's v3 marker position

I have one custom div with any info and google map with many markers. On click on marker I want the div to appear next to the marker. I use api v3. Could you help me to find solution?
Actually I want to know offset position of a marker in html window.

Google maps v3 info window opening outside map viewport

If a marker is clicked near the top of the map viewport, the infowindow loads outside the viewable area and the map must be dragged to see infowindow content.
Ideally I don't want the map to auto pan. Is there a way to load the infowindow in a different direction, e.g. if the marker is at the top of the viewport to display the infowindow in a downward direction.
No, you can't open google's default infowindows in a different direction since you don't implement your own infowindow class. But you can disable auto-pannnig simply passing TRUE to disableAutoPan property of InfoWindowOptions object like documentation said.
There is an example that used to be part of the Google Maps JavaScript API v3 Code Samples, that has moved over to GitHub, named: SmartInfoWindow. It does exactly what you are describing. Check into the underlying code and that should get you going in the right direction.

How to update the google map if the map canvas of it changed its dimenstions?

I have a google map inside of a div which gets changed, its parent div can get an additional class which changes its dimensions. This changes causes the google map not to get updated, it resist in the previous dimensions. How can I refresh the google map?
I tried to recreate the google map again but it seems to keep the other previously created google maps there as well. This causes sometimes strange behavior (the old map is on the top of the new). Can a google map be released?
Thanks for your help!
Check the google.maps.Map class reference, I think you're looking for the resize event:
Developers should trigger this event on the map when the div changes size:
google.maps.event.trigger(map, 'resize')
While re-sizing the existing map would be more elegant, as a workaround you can empty the container div before re-creating the map, e.g. while (div.firstChild) div.removeChild(div.firstChild) or $(div).empty().

Categories

Resources