I’m having some problems with google maps (api v3) when I embed them into an iframe.
When I click somewhere on the map, drag it until the cursor is out of the iframe, and release the mouse button, then the map sticks to the cursor when I move it over the map, even if I’m not pressing the mouse button anymore.
http://my.brandtr.ee/public/tmp/test-iframe.html
It seems that if the map is embedded within an iframe, then the “mouseup” event isn’t catched by the map if the user release the mouse button outside of the iframe.
This problem only occurs with webkit browsers (chrome 23, safari 6) and IE. Firefox is working fine.
Did anyone already have this problem? It’s been bugging me for days now…
Thanks in advance.
I’m not entirely certain what event Google Maps relies on in order to stop dragging the map, but just in playing around with your demo I noticed that it stops when you
mouseupinside the iframe. If you simulate this event onmouseoutof the iframe, Google Maps thinks you let go of the map there, and stops dragging.I tried this code from inside the console and it works fine:
This works in FF, Safari, Chrome, and Opera. I took a quick look at your page in IE without applying the fix. However, it doesn’t look like the drag bug is even happening there, so it may not be worth providing for that case. Good luck!