javascript - Programmatically opening a popup in a Mapbox map -
i have mapbox map @ http://bei.dev.bclcmaps.com/ has popups open when clicking marker.
my problem need way set default popup open on page load based on value in url. can latitude , longitude or other value, whatever's easiest.
i have banged on while , seems either need to:
- programmatically open popup via mapbox js api, can't figure out since seems popups auto-generated on fly when marker clicked, or
- programmatically click marker open popup. can't figure out because 1) don't know how find marker lat/lon , 2) can't figure out how click marker js.
i've tried this:
map.gridlayer.fire('click', {latlng: l.latlng(28.04419, -81.947864)});
which closes existing open popups doesn't seem open own. i've tried digging through map , leaflet objects see if location/marker data stored in there , can't find besides tiles.
most of examples can find seem using geojson i'm not using makes things difficult.
any advice?
map.fireevent('click', {latlng: l.latlng(28.04419, -81.947864)});
you close - 'click' event needs latlng object named 'latlng' (lower case)
Comments
Post a Comment