I will like to know how I can insert a ‘close button’ for a bootstrap popover. Additionally, I will like the popover to close automatically after x number of seconds (say 8 seconds).
<a href='#' id='example' rel='popover' data-animation="true" data-placement='left' data-content='Its so simple to create a tooltop for my website!' title='Twitter Bootstrap Popover'></a>
In my JS, I have
$('#example').popover({
'placement':'bottom',
}).popover('show');
2
Answers
I can’t help with the close button, but if you want to show the popover after a button click, and then hide it after 8 seconds, for example:
In my case I use it in a E-commerce website so there’s lots of buttons which may be clicked and open popovers, so I put a class inside the button tag called ‘pop’ and the code will be like:
And now everytime the user clicks any button with the class "pop" the popover comes up and hide after 8 seconds.
You’d have to override the template and attach a click function: