Draggable Marker Lag in IE8 + FF

75 views
Skip to first unread message

Michael

unread,
Sep 15, 2011, 9:35:05 PM9/15/11
to Google Maps JavaScript API v3
Hi,

I have implemented something that constantly calculates distance/
bearing and updates text when a marker is being dragged on the map. It
is similar to this, http://gmaps-samples-v3.googlecode.com/svn/trunk/draggable-markers/draggable-markers.html.
That site's lag behaviour and mine is exactly the same.

Now in chrome, when the marker is dragged, there is no lag at all. In
firefox, there is a slight lag/delay if you move the marker faster
than usual. However, in IE8, there is HUGE marker lag, as you can see
in the site I linked above. The text is updating perfectly, as it is
on the sample site.
In firefox, when I stop displaying/updating the text (but keep
calculating it), the marker lag is removed completely. Doing this in
IE nearly removes the lag completely as well.

I just don't know why changing the inner html of div elements would
affect how the marker is displayed on the map.

Does anyone know what the cause of this is and if there is any way to
fix the lag in IE8 and firefox?

Cheers.

Michael

unread,
Sep 26, 2011, 9:47:50 PM9/26/11
to google-map...@googlegroups.com
Ideas anyone?

Chris Broadfoot

unread,
Sep 26, 2011, 10:36:09 PM9/26/11
to google-map...@googlegroups.com
On Fri, Sep 16, 2011 at 11:35 AM, Michael <blasz...@hotmail.com> wrote:
I just don't know why changing the inner html of div elements would
affect how the marker is displayed on the map.

It would definitely affect performance. Updating the innerHTML is an operation on the DOM, and would trigger a repaint of that element (if not a reflow of the page). This can be slow in some browsers.

I'd suggest updating the DOM only every N milliseconds.

Chris

--

Reply all
Reply to author
Forward
0 new messages