Commit | Line | Data |
---|---|---|
c5ba5b04 JW |
1 | /*\r |
2 | * Popup extension to L.Marker, adding openPopup & bindPopup methods. \r | |
3 | */\r | |
4 | \r | |
5 | L.Marker.include({\r | |
6 | openPopup: function() {\r | |
7 | this._popup.setLatLng(this._latlng);\r | |
8 | this._map.openPopup(this._popup);\r | |
9 | \r | |
10 | return this;\r | |
11 | },\r | |
12 | \r | |
13 | closePopup: function() {\r | |
14 | if (this._popup) {\r | |
15 | this._popup._close();\r | |
16 | }\r | |
17 | },\r | |
18 | \r | |
19 | bindPopup: function(content, options) {\r | |
20 | options = L.Util.extend({offset: this.options.icon.popupAnchor}, options);\r | |
21 | \r | |
22 | this._popup = new L.Popup(options);\r | |
23 | this._popup.setContent(content);\r | |
24 | this.on('click', this.openPopup, this);\r | |
25 | \r | |
26 | return this;\r | |
27 | }\r | |
28 | }); |