Hi, I've added the Bookmark widget and would like to automatically close when a user chooses a bookmark.
Any suggestions?
thanks
~stefan (javascript beginner)
Hi Stefan! You can watch for the "bookmark-select" event and then close the expand widget, like this:
const bookmarksWidget = new Bookmarks({ view: view }); const bookmarksExpand = new Expand({ view: view, content: bookmarksWidget }); view.ui.add(bookmarksExpand, "top-right"); // collapses the associated Expand instance // when the user selects a bookmark bookmarksWidget.on("bookmark-select", function(event){ bookmarksExpand.expanded = false; });
Thanks AnneFitz. That works great!
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.