Popovers Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site.

Basic Popover

Minimalistic popover with no content - just title

Popover Content

Default content value if data-content={string|element|function} attribute isn't present.

If a function is given, it will be called with its this reference set to the element that the popover is attached to.

Popover Animation

Disable the CSS fade transition to the popover using attribute data-animation="false"

Popover Title

Default title value if title attribute isn't present.

If a function is given, it will be called with its this reference set to the element that the popover is attached to.

Popover Container

Appends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize
hide container
The popover is nested inside this container but displayed on the element above. Once this container is hidden the popover will not be visible. Try hiding this container by pressing the "hide" button above

Popover HTML content

Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.

Some elements may not be displaced properly or may not appear at all. This is because of bootstrap Sanitizer. If this is happening you may need to add these elements to the "whitelist". You can read more about it on bootstrap's official documentation.

Delayed Popover

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 }

Popover Placement

How to position the popover - auto | top | bottom | left | right.
When auto is specified, it will dynamically reorient the popover.

When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.

Popover Selector

If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added.

The selector option essentially allows you to run tooltips and popovers using jQuery's on function, which means that you can allow dynamically added HTML with the correct selectors to trigger popups as if they were present in the originally loaded DOM. Without the selector option, only elements present in the initial DOM will trigger tooltips; any that are dynamically added will not.

Toggle the checkbox below and click the 'add new popover' button to observe the behavioral differences between using the selector option, and not using it.


$('body').popover({
  selector: '.has-popover'
});
$('.has-popover').popover();

Popover Triggers

How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. manual cannot be combined with any other trigger.

Popover Template

Base HTML to use when creating the popover. The popover's title will be injected into the .popover-header. The popover's content will be injected into the .popover-body, and .arrow will become the popover's arrow.The outermost wrapper element should have the .popover class.

Offset Popover

Offset of the popover relative to its target. For more information refer to Popper.js's offset docs

Popover Boundary

Overflow constraint boundary of the popover. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's preventOverflow docs