hosuaby / Leaflet.SmoothMarkerBouncing

Smooth animation of marker bouncing for Leaflet.
BSD 2-Clause "Simplified" License
146 stars 28 forks source link

Find point #27

Closed lvcsistemas closed 4 years ago

lvcsistemas commented 4 years ago

I liked so much your plugin.

I have a list with all the points in the map and I would like to click in this list and make the icon bounce, not clicking directly on it.

On Google maps I do something like:

marker[index].setAnimation(google.maps.Animation.BOUNCE);

Thanks in advanced.

hosuaby commented 4 years ago

Thanks, @lvcsistemas . It's always a pleasure to hear that :)

You don't necessairy need to click on the marker to start bouncing animation. You can make like in your example for google.maps bouncing. Assuming, you have references to all markers in the list you can do just:

marker[index].bounce();

Keep one thing in mind! You need to add marker to the map before the call to .bounce() method:

marker[index].addTo(map)
lvcsistemas commented 4 years ago

Simply perfect, I did as you mentioned and now is working as I want.

Thanks a lot.