Reputation: 780
I have some problem with bootstrap popover, in particular it appear only the second time that I hover the mouse on it. The first time nothing is displayed, I don't understand why. This is my code:
<div id="popover-content" class='popup' rel='popover'>hover me</div>
this is the js:
$(document).ready(function()
{
$('body').on('mouseover', '.popup', function()
{
console.log("sdsdsds");
$('body').popover({
placement: 'bottom',
container: 'body',
html: true,
selector: '[rel="popover"]',
trigger: 'hover focus',
title: 'test',
content: 'foo'
});
});
});
Upvotes: 1
Views: 1315
Reputation: 11462
Lose the $('body').on('mouseover', '.popup', function()
and it will work.
Updated FIDDLE.
If you want to bind the mouseover
you can chain it to the popover
like this:
$(document).ready(function() {
$('body').popover({
placement: 'bottom',
container: 'body',
html: true,
selector: '[rel="popover"]',
trigger: 'hover focus',
title: 'test',
content: 'foo'
}).on('mouseover', '.popup', function() {
console.log('test')
});
});
Upvotes: 3