开发者

Google Maps API v3: Problem drag and drop jquery with IE

The idea is to drag elements from outside Google map DIV and drop them into Google maps, then a marker must be placed in the lat/long where the element was dropped.

Basically i created two global variables for the javascript

var latFromMap;var longFromMap;

...

    google.maps.event.addListener(map, 'mousemove', function(event) {
        latFromMap = event.latLng.lat();
        longFromMap = event.latLng.lng();
        document.getElementById("positionLatLng").innerHTML = event.latLng.lat() + "  +++++++  " + event.latLng.lng();
   });

As you can see the lat/long is always captured into those variables, so i can create a marker.

Then i have an element with JQUERYUI drag/drop when it's dropped then a marker is added. When i'm using FF/Chrome it works fine, but when i'm using IE the position is not registered while i'm on the "dragging" time.

Anyone can help me out with this ?

Regards

George

PS. Here you may see what i'm t开发者_开发百科rying to accomplish:

http://www.cheiscorp.com/newUI/LocatorTesterv05.html


You prob. need to calculate the lat/lng coordinate of the mouse cursor yourself to get it running in all browsers.

This means you have to keep polling the mouse position on the map div and get the matching coordinate with the helper functions of gmaps (see http://code.google.com/intl/en-US/apis/maps/documentation/javascript/reference.html#MapCanvasProjection)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜