XF 2.0 Function to close a menu

Russ

Well-known member
I'm aware of clicking off the menu closes any normal XF menu, but is there a built-in way to close it similar to how you can close an overlay:

Code:
<xf:button class="button--primary js-overlayClose">Close</xf:button>{/code]
 
like this?

L0DVkxZ0zL.gif


or how about displaying a "fake" close button that is a little "outside" the menu?
 
You can add data-menu-closer="true" to the link/button.

We use this in a few places.

Whenever there's a menu item that performs an action but you want that to also trigger the menu to close, we use it there. For example the post action bar when it collapses to a menu for one or two options in there, or the Close/Open thread link in the thread tools menu.

More recently, we've used it in the emoji menu in the editor. Although it may not immediately seem like it, that's actually a standard XF menu we display there rather than anything related to the editor itself. The close button there uses the data-menu-closer attribute to close the menu.
 
Top Bottom