Skip to content

Getting an existing bar instance

getBar()

Get bar instance by name.

ArgumentTypeDefaultDescription
namestringBar name
javascript
bartender.getBar('mobileNav')

getOpenBar()

Get the topmost open bar instance.

ArgumentTypeDefaultDescription
modalboolean | undefinedundefined -> Search from all bars. true -> Search from modal bars only. false -> Search from non-modal bars only.
javascript
// Get the topmost open bar, regardless of the modal property
bartender.getOpenBar()

// Get the topmost open modal bar
bartender.getOpenBar(true)

// Get the topmost open non-modal bar
bartender.getOpenBar(false)

Released under the MIT License.