diff options
-rw-r--r-- | src/leaflet-soton.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index cb8184b..89f82dc 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -166,13 +166,17 @@ }, onEachFeature: function(feature, layer) { layer.on('click', function(e) { - var popupOptions = { - offset: icons.vendingHotDrinks.options.popupAnchor - }; - var content = pointOfServiceTemplate(feature.properties); + // If this is a leaflet-soton map + if ("showInfo" in this._map) { + var popupOptions = { + offset: icons.vendingHotDrinks.options.popupAnchor + }; + + var content = pointOfServiceTemplate(feature.properties); - map.showInfo(content, e.latlng, popupOptions); + this._map.showInfo(content, e.latlng, popupOptions); + } }); } }); |