I have a non-bootstrap project which requires popover functionality.
I'd like to use bootstrap's popovers, but don't want to include all of bootstrap, since I'll only be using this one feature. I'd also be open to suggestions for a different standalone popover widget.
Bootstrap's popover are described here, with examples:
http://getbootstrap.com/javascript/#popovers
My questions are:
Thanks!
To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.
To make the image on hover in popover just insert an image as an HTML element to the data-mdb-content and set the data-mdb-html to true .
You can also check using a condition $('#anElement'). next(). hasClass('popover') which will return true if the popover is on.
The data-toggle attribute defines the Popover, the title attribute defines the Tile for the Popover and the data-content attribute is used to store the content to be displayed in the respective Popover.
Here's a fiddle with the relevant snippets of Bootstrap. The relevant classes are:
.popover
.popover.top
.popover.right
.popover.bottom
.popover.left
.popover-title
.popover-content
.popover .arrow
.popover .arrow:after
.popover .arrow
.popover .arrow:after
.popover.top .arrow
.popover.top .arrow:after
.popover.right .arrow
.popover.right .arrow:after
.popover.bottom .arrow
.popover.bottom .arrow:after
.popover.left .arrow
.popover.left .arrow:after
Yes, since popover extends tooltip. And you'll need jQuery if you're not already using it.
I've also heard some nice things about qTip2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With