I have a large map taking up most of the page. The native map width is 5000px, but I reduce it to 1200px initially. What I'd like to do, is when you click anywhere on the map, you zoom into that exact pointer location. I have the zoom animation working - it animates the map width to its original 5000px width within its wrapper, but I can't get the scrollLeft and scrollTop in sync with the zoom so that it smoothly zooms into that location. As it behaves now, it races in in a wobbly manner, oscillating then at completion, it snaps back to the original. I think the oscillating is due to the map width expanding and throwing off the scroll coords as it does Here is my attempt:
wrapper.mousemove(function(e) {
window.x = e.pageX;
window.y = e.pageY - main_menu.height();
mouse_xy(x,y)
});
wrapper.click(function() {
//alert("X="+x +" Y="+y)
world_map_img.animate({"width":"5000px"}, zoom_speed)
wrapper.animate({scrollLeft: x }, zoom_speed);
wrapper.animate({scrollTop: y }, zoom_speed);
return false;
})
Any advice would be appreciated