Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps - markers flash before bounce onmouseover
    primarykey
    data
    text
    <p>I've built a google map where the markers bounce on rollover of some external links. I've created this short function to bounce the marker:</p> <pre><code>function makeBounce(marker) { marker.setAnimation(google.maps.Animation.BOUNCE); setTimeout(function(){ marker.setAnimation(null); }, 750); } </code></pre> <p>and I'm using this to execute it:</p> <pre><code>&lt;a onmouseover="javascript:map.panToBounds(bounds);makeBounce(markersArray[1]);" href="javascript:google.maps.event.trigger(markersArray[1], 'click');"&gt;Marker name&lt;/a&gt; </code></pre> <p>What I'm noticing is that just before the markers bounce they flash. It's almost imperceptible, but it's enough to be really annoying (especially since Google's own blog post launching bouncing markers is very smooth: <a href="http://googlegeodevelopers.blogspot.com/2010/12/map-markers-they-move.html" rel="nofollow">http://googlegeodevelopers.blogspot.com/2010/12/map-markers-they-move.html</a>).</p> <p>I've created a JS Fiddle here which demonstrates it: <a href="http://jsfiddle.net/RmDuz/" rel="nofollow">http://jsfiddle.net/RmDuz/</a> (roll over the blue links to see the problem).</p> <p>I've tried it in FF9 and Chrome 16 and the problem is there in both.</p> <p>Any thoughts?</p> <p>The problem seems to be that the marker image is dynamically (re)loaded just before the bounce, because in Chrome I see the 'no image' box just before the marker reappears then bounces.</p> <p>EDIT: I've altered the code to make use of a maps API listener instead of a javascript function, in the hope that the API code might be a bit more efficient, but no joy :(</p> <pre><code> google.maps.event.addListener(marker, 'dblclick', (function(marker, i) { return function() { marker.setAnimation(google.maps.Animation.BOUNCE); setTimeout(function(){ marker.setAnimation(null); }, 750); } })(marker, i)); </code></pre> <p>I'm using dblclick because I don't want mouseover, which would mean the animation was triggered when the markers are rolled over. I only want the animation triggered when the external links are rolled over:</p> <pre><code>&lt;a onmouseover="javascript:google.maps.event.trigger(markersArray[1], 'dblclick');"&gt;Link name&lt;/a&gt; </code></pre> <p>I've updated the JS Fiddle to reflect this: <a href="http://jsfiddle.net/RmDuz/1/" rel="nofollow">http://jsfiddle.net/RmDuz/1/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload