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)
Solved! Go to Solution.
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;
});
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!