Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap, show all popovers at one div

I tried to achieve the following using Twitter Bootstrap 2.0 and it's popover-plugin, but after a few hours, I still can't figure it out.

Let's just say, on the down-left corner of my page I got a picture showing a bird. This bird should "speak" every popover, for example the ones for a registration form, should appear on top of the bird. Is this possible?

For better understanding I created a test site over here. If you hover over the registration fields, there are the popovers. I want them to appear over the bird-img in the down-left corner, but I don't know how to achieve this. It would be great if you could help me.

like image 879
Dominik Avatar asked Jun 23 '12 17:06

Dominik


1 Answers

Method 1:

The jQuery hover handler takes an "in" and an "out" method, and in your sample you are only assigning the "in" method, to show the popup. This is fine, but rather than attach it to "this", you should attach it to your bird image. Make sure to change the trigger of the popup to manual also. Then in the "out" method of hover, you just need to hide the popover.

$('#registerHere input').hover(function()
{
    $('#birdie').popover({
            "trigger": 'manual',
            "placement":'top',
                }).popover('show');
},
function()
{
    $('#birdie').popover('hide');
});

Method 2:

Alternately, keep what you have, but use the "selector" option provided, and give it your bird image as a parameter, this should trigger the popover from your control, but delegate it to your bird image.

selector: if a selector is provided, tooltip objects will be delegated to the specified targets

$('#registerHere input').hover(function()
{
    $('#birdie').popover({
            "selector": "#birdie",
            "placement":'top',
                }).popover('show');
});

EDIT: Added sample code. I don't have a chance to test this, so there might be some syntax error or something, but the general idea is there.

like image 69
Miika L. Avatar answered Sep 19 '22 14:09

Miika L.