File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -257,3 +257,29 @@ folium.GeoJson(
257257
258258m
259259```
260+
261+ #### Keep highlighted while popup is open
262+
263+ The ` GeoJson ` class provides a ` popup_keep_highlighted ` boolean argument.
264+ Whenever a GeoJson layer is associated with a popup and a highlight function
265+ is defined, this argument allows you to decide if the highlighting should remain
266+ active while the popup is open.
267+
268+ ``` {code-cell} ipython3
269+ m = folium.Map([43, -100], zoom_start=4)
270+
271+ popup = folium.GeoJsonPopup(fields=["name"])
272+
273+ folium.GeoJson(
274+ geo_json_data,
275+ highlight_function=lambda feature: {
276+ "fillColor": (
277+ "green" if "e" in feature["properties"]["name"].lower() else "#ffff00"
278+ ),
279+ },
280+ popup=popup,
281+ popup_keep_highlighted=True,
282+ ).add_to(m)
283+
284+ m
285+ ```
You can’t perform that action at this time.
0 commit comments