From 068833709ae26fbbe87e9b079d5e1160d0f7fcec Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 17 Sep 2014 15:10:21 +0100 Subject: Fix problem with map variable --- src/leaflet-soton.js | 14 +++++++++----- 1 file 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); + } }); } }); -- cgit v1.2.3