Bootstrap: popover on modals

一曲冷凌霜 提交于 2019-12-07 02:30:39

问题


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 ?


回答1:


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




回答2:


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

.popover {
    z-index: 1060;
}



回答3:


In the meanwhile you can try:

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

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



回答4:


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

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



回答5:


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.



来源:https://stackoverflow.com/questions/7675203/bootstrap-popover-on-modals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!