I am trying to do almost exactly what Charleshaa did two years ago, so my code looks really similar to the code suggested in the answers given back then.
But something really annoys me: when the width of the map-canvas
(map container) is increased, the map itself stays on the left of the canvas and the additional area is added on the right.
Just a millisecond or so later map.setCenter(oldCenter);
is called and the position of the map inside the container changes (to the right).
This change can be seen (as a jump to the right) and is really annoying.
Is there a way to set the center at the same time the map is resized, not shortly after?
I resize the map with $("#map-canvas").css("width","100%");
. So I would like to synchronize a jQuery CSS event and a Google Maps event.
Thanks a lot,
timon
EDIT
I would like to show a sidebar on the left, so when somebody clicks on the map, the sidebar appears and the map has to reload (the center should stay the same).
To show you, I did a jsfiddle but this time the map behavior is perfect. The jsfiddle contains only part of my code, because otherwise I would have to post a lot more.
I guess my coding is so bad, that it makes the map a little bit jumpy, am I right?