hosuaby / Leaflet.SmoothMarkerBouncing

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

TypeError: (intermediate value).bounce is not a function #11

Closed andesim closed 6 years ago

andesim commented 6 years ago

I receive this error: Uncaught (in promise) TypeError: (intermediate value).bounce is not a function

        var incIcon = new L.icon({
           iconUrl: '/images/icons/incident.png',
           iconSize: [35, 95],
        });
        var marker = new L.marker([e.latlng.lat, e.latlng.lng], {
            icon: incIcon,
            zIndexOffset: 1000
        }).bounce();
hosuaby commented 6 years ago

1) Make sure you are imported both Leaflet and import 'leaflet'; import 'leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing.js' in current file or globally

import 'leaflet';
import 'leaflet.smooth_marker_bouncing/leaflet.smoothmarkerbouncing.js';

2) You forgot .addTo(map) before .bounce()