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!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.