I
I
iTube2011-09-12 14:23:32
JavaScript
iTube, 2011-09-12 14:23:32

Reinitializing Google maps V3

There is a page with a map, facebox should also appear on top of it with a map.

But facebox doesn't show map.
And if there is no map on the page, it is displayed.

That is, only one card is shown at a time.

Has anyone encountered a similar problem?

Functions for calling cards:
function gmap_5() {
var latlng_5 = new google.maps.LatLng(55.7558, 37.6176);
var myOptions_5 = {
zoom: 8,
center: latlng_5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map_5 = new google.maps.Map(document.getElementById("map_5"), myOptions_5);
}
gmap_5();

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Z
zoc, 2011-09-12
@zoc

You store maps in the same map_5 variable, create a separate variable for the second map, or if you need many maps, make an array.

I
iTube, 2011-09-12
@iTube

For example, I wrote one function. Of course the numbers are different.
So the second function looks like this:
function gmap_6() {
var latlng_6 = new google.maps.LatLng(55.7558, 37.6176);
var myOptions_6 = {
zoom: 8,
center: latlng_6,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map_5 = new google.maps.Map(document.getElementById("map_6"), myOptions_6);
}
gmap_6();

W
Wott, 2011-09-12
@Wott

Something is wrong in the conservatory.
Here everything works for me as written above: http://wott.info/examples/2ndgmap.html

A
Alexander, 2015-09-21
@Kr1og5n

Same stuff. The variables are different. The first map loads normally, the second appears, but only a rectangle with a gray background - there is no map itself.
Maybe you found a solution to the problem, please share;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question