This should be refactored but here is the basic gist of it:
$('.popover-manual').popover({trigger: 'manual'}).focus(function () {
var target = $(this);
target.data('element-focused', true);
var hovered = !!target.data('element-hovered');
if (hovered) {
return;
}
target.popover('show');
}).blur(function () {
var target = $(this);
target.data('element-focused', false);
var hovered = !!target.data('element-hovered');
if (hovered) {
return;
}
target.popover('hide');
}).hover(function () {
var target = $(this);
target.data('element-hovered', true);
var focused = !!target.data('element-focused');
if (focused) {
return;
}
target.popover('show');
}, function () {
var target = $(this);
target.data('element-hovered', false);
var focused = !!target.data('element-focused');
if (focused) {
return;
}
target.popover('hide');
});
On Wednesday, February 1, 2012 4:02:55 PM UTC-5, Sebastien Cesbron wrote:
>
> Hi
>
> I want to show a popover on hover or on focus : if the user hover an input
> whith the mous I show the popover but if he click and then tab to another
> input, I want the popover of the new input to be shown.
>
> To do so, I am using the manual mode like that :
>
> $('.popover-manual').popover({trigger: 'manual'}).focus(function() {
> $(this).popover('show');
> }).blur(function() {
> $(this).popover('hide');
> }).hover(function() {
> $(this).popover('show');
> },function() {
> $(this).popover('hide');
> });
>
> But there is a small blink when I click in my input : does somebody know
> how to avoid this blink ?
>
> Regards
> Seb
>
>
>