Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap static popover

In the bootstrap popover documentation (http://getbootstrap.com/javascript/#popovers) they show on the page the the popover looks like in a static way (before the example where it's connected to the buttons).

I would like to show a popover on my page as an explanation to something on my site - but would like it to always show, without the user having to click anything.

how can I show a static popover like they do? couldn't find an option.

Thanks

like image 257
developer82 Avatar asked Jan 23 '14 05:01

developer82


People also ask

How do I enable popovers in bootstrap?

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.

How do I customize bootstrap popover?

To create a popover, you need to add the data-bs-toggle="popover" attribute to an element. Whereas, popover's title and its content that would display upon trigger or activation can be specified using the title and data-bs-content attribute respectively. Here is the standard markup for adding a popover to a button.


2 Answers

If you inspect the HTML that Bootstrap use in their examples they've simply removed the fade class from the HTML element and then overriden a few of the default styles.

HTML

<div class="popover-example"> <!-- NEW -->
  <div class="popover top">
    <div class="arrow"></div>
    <h3 class="popover-title">Popover top</h3>
    <div class="popover-content">
      <p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p>
    </div>
  </div>
</div>

CSS

.popover-example .popover {
  position: relative;
  display: block;
  margin: 20px;
}

DEMO

like image 129
davidpauljunior Avatar answered Oct 03 '22 11:10

davidpauljunior


Try this:

$('your_selector').popover('show');
like image 40
rboarman Avatar answered Oct 03 '22 11:10

rboarman