Zooming with mouse wheel/double-click forces pan

Discussion created by rmartin4 on Sep 18, 2013
Latest reply on Sep 19, 2013 by rmartin4
Hi everyone,

I have a map that I'm initializing off-screen and sliding in using jQuery. For some reason zooming in with the scroll wheel or by double-clicking causes the map to simultaneously pan down (or pan up when zooming out). Using the slider controls works fine. Also if I disable the animation and create it on-screen it zooms normally. I'm guessing it has something to do with the relative position of the map to where it was created, but I don't imagine I have much control over that. Does anyone have any thoughts on this?

Here's how I'm styling the map:

#map {
 bottom: -450px;
 height: 450px;
 position: fixed;
 width: 100%;

And this is my animation function:

toggleMap: function() {
 // New bottom value
 var newBottom;

 if (isShowing) {
  newBottom = -MAP_HEIGHT;
 else {
  newBottom = 0;

 // Set this here in case they reverse the animation before it finishes
 isShowing = !isShowing;

 // Change link text
 $('#gis-link').text(!isShowing ? 'show' : 'hide');

 // Animate
  bottom: newBottom