Popover Module

Usage

Enable popovers via JavaScript:

query('#example').popover(options)

Markup

For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-animation="".

Nametypedefaultdescription
animationbooleantrueapply a css fade transition to the tooltip
htmlbooleantrueInsert html into the popover. If false, dojo's NodeList text method will be used to insert content into the dom. Use text if you're worried about XSS attacks.
placementstring|function'right'how to position the popover - top | bottom | left | right
selectorstringfalseif a selector is provided, tooltip objects will be delegated to the specified targets
triggerstring'click'how popover is triggered - click | hover | focus | manual
titlestring | function''default title value if `title` attribute isn't present
contentstring | function''default content value if `data-content` attribute isn't present
delaynumber | object0

delay showing and hiding the popover (ms) - does not apply to manual trigger type

If a number is supplied, delay is applied to both hide/show

Object structure is: delay: { show: 500, hide: 100 }

Heads up! Options for individual popovers can alternatively be specified through the use of data attributes.

Methods

MethodDescription
destroyHides and destroys an element's popover.
hideHides an element's popover.
showShows an element's popover.
toggleToggles an element's popover.

Examples

Add small overlays of content, like those on the iPad, to any element for housing secondary information. Hover over the button to trigger the popover. Requires Tooltip to be included.

Static popover

Four options are available: top, right, bottom, and left aligned.

Popover top

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover right

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover left

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover bottom

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

No markup shown as popovers are generated from JavaScript and content within a data attribute.

Live demo