Add small overlays of content, like those on the iPad, to any element for housing secondary information.
<h2id="popovers-examples">Examples</h2>
<p>Add small overlays of content, like those on the iPad, to any element for housing secondary information.</p>
<divclass="bs-callout bs-callout-danger">
<divclass="bs-callout bs-callout-danger">
<h4>Plugin dependency</h4>
<p>Popovers require the <ahref="#tooltips">tooltip plugin</a> to be included in your version of Bootstrap.</p>
</div>
<divclass="bs-callout bs-callout-danger">
</div>
<divclass="bs-callout bs-callout-danger">
<h4>Opt-in functionality</h4>
<p>For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning <strong>you must initialize them yourself</strong>.</p>
</div>
<divclass="bs-callout bs-callout-warning">
</div>
<divclass="bs-callout bs-callout-warning">
<h4>Popovers in button groups and input groups require special setting</h4>
<p>When using popovers on elements within a <code>.btn-group</code> or an <code>.input-group</code>, you'll have to specify the option <code>container: 'body'</code> (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the popover is triggered).</p>
</div>
<divclass="bs-callout bs-callout-warning">
</div>
<divclass="bs-callout bs-callout-warning">
<h4>Don't try to show popovers on hidden elements</h4>
<p>Invoking <code>$(...).popover('show')</code> when the target element is <code>display: none;</code> will cause the popover to be incorrectly positioned.</p>
</div>
<divclass="bs-callout bs-callout-info">
</div>
<divclass="bs-callout bs-callout-info">
<h4>Popovers on disabled elements require wrapper elements</h4>
<p>To add a popover to a <code>disabled</code> or <code>.disabled</code> element, put the element inside of a <code><div></code> and apply the popover to that <code><div></code> instead.</p>
</div>
</div>
<h3>Static popover</h3>
<p>Four options are available: top, right, bottom, and left aligned.</p>
<divclass="bs-example bs-example-popover">
### Static popover
Four options are available: top, right, bottom, and left aligned.
<buttontype="button"class="btn btn-lg btn-danger bs-docs-popover"data-toggle="popover"title="Popover title"data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
</div>
{% highlight html %}
<buttontype="button"class="btn btn-lg btn-danger"data-toggle="popover"title="Popover title"data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
{% endhighlight %}
### Live demo
<h4>Four directions</h4>
<divclass="bs-example popover-demo">
{% example html %}
<buttontype="button"class="btn btn-lg btn-danger bs-docs-popover"data-toggle="popover"title="Popover title"data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
{% endexample %}
#### Four directions
<divclass="bs-example popover-demo">
<divclass="bs-example-popovers">
<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="left"data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on left
...
...
@@ -93,7 +90,8 @@ title: Popovers
Popover on right
</button>
</div>
</div><!-- /example -->
</div>
{% highlight html %}
<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="left"data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on left
...
...
@@ -113,33 +111,37 @@ sagittis lacus vel augue laoreet rutrum faucibus.">
</button>
{% endhighlight %}
<h4>Dismiss on next click</h4>
<p>Use the <code>focus</code> trigger to dismiss popovers on the next click that the user makes.</p>
<buttontype="button"class="btn btn-lg btn-danger bs-docs-popover-dismiss"data-toggle="popover"title="Dismissible popover"data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</button>
</div>
{% highlight html %}
#### Dismiss on next click
Use the `focus` trigger to dismiss popovers on the next click that the user makes.
{% example html %}
<buttontype="button"class="btn btn-lg btn-danger popover-dismiss"data-toggle="popover"title="Dismissible popover"data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</button>
{% endhighlight %}
{% endexample %}
{% highlight js %}
$('.popover-dismiss').popover({
trigger: 'focus'
})
{% endhighlight %}
<divclass="bs-callout bs-callout-warning">
<divclass="bs-callout bs-callout-warning">
<h4>Multiple-line links</h4>
<p>Sometimes you want to add a popover to a hyperlink that wraps multiple lines. The default behavior of the popover plugin is to center it horizontally and vertically. Add <code>white-space: nowrap;</code> to your anchors to avoid this.</p>
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-animation=""`.
<h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>