Renders a richer version of a tooltip, called a popover.

Examples

Basic usage

You may add data-control="popover" to an anchor or button to activate a popover. Use the data-content attribute to specify the contents.

<a
    href="javascript:;"
    class="btn btn-primary"
    data-control="popover"
    data-content="I am a standard popover">
    Basic popover
</a>

Template content

Define the popover content as a template and reference it with data-content-from="#myPopoverContent".

<script type="text/template" id="myPopoverContent">
    <div class="popover-head">
        <h3>Popover</h3>
        <button type="button" class="close" data-dismiss="popover">&times;</button>
    </div>
    <div class="popover-body">
        I am a popover
    </div>
</script>
<a
    href="javascript:;"
    class="btn btn-primary"
    data-control="popover"
    data-width="200"
    data-content-from="#myPopoverContent">
    Template popover
</a>

Event specified content

$('#btn1').on('showing.oc.popover', function(e, popover) {
    popover.options.content = '<div class="popover-body">Some other content</div>'
})
<a
    href="javascript:;"
    class="btn btn-primary"
    data-control="popover"
    data-placement="right"
    id="btn1">
    Event content popover
</a>

JavaScript API

$('#element').ocPopover({
    content: '<p>This is a popover</p>'
    placement: 'top'
})

Supported methods

.ocPopover('hide') Closes the popover. There are 3 ways to close the popover: call it's hide() method, trigger the close.oc.popover on any element inside the popover or click an element with attribute data-dismiss="popover" inside the popover.

Supported options

Supported events