最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap: popover on modals - Stack Overflow

programmeradmin0浏览0评论

I want to use the popover effect on an existing modals dialog using the Bootstrap CSS Library from Twitter. I bind the popover to the small image icon.

$('#infoIcon').popover({
    offset: 50,
    placement: 'right'
});

The modals itself is also added according the documentation:

$('#modalContainer').modal({
    keyboard : true
});

But the effect I've got is, that the popover is rendered UNDER the modal container instead OVER the modal div (see the screenshot below). How can I bring the popover truly OVER the modal div ?

I want to use the popover effect on an existing modals dialog using the Bootstrap CSS Library from Twitter. I bind the popover to the small image icon.

$('#infoIcon').popover({
    offset: 50,
    placement: 'right'
});

The modals itself is also added according the documentation:

$('#modalContainer').modal({
    keyboard : true
});

But the effect I've got is, that the popover is rendered UNDER the modal container instead OVER the modal div (see the screenshot below). How can I bring the popover truly OVER the modal div ?

Share Improve this question edited May 25, 2012 at 2:59 wallyk 57.8k17 gold badges89 silver badges152 bronze badges asked Oct 6, 2011 at 13:48 DominikDominik 1,4311 gold badge18 silver badges32 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 9

The guys at Bootstrap identifies this issue as a bug and fixed it for the next release. see more details here

You don't need javascript for that, simply set the z-index of the popover via CSS:

.popover {
    z-index: 1060;
}

In the meanwhile you can try:

$('#infoIcon').popover({
    offset: 50,
    placement: 'right'
});

$("#infoIcon").data('popover').tip().css("z-index", 1060);

if you need to work on fly, you should be use

$("<style type='text/css'> .popover{z-index:1060;} </style>").appendTo("head");

Try to check what is the z-index value of one window and modify the z-index for the another one with a superior value. You can do this with jQuery css function if the plugins that you are using do not allow this change in their input parameters.

发布评论

评论列表(0)

  1. 暂无评论