相关疑难解决方法(0)

弹出框未固定到触发元素

因此Twitter Bootstrap popovers,当触发元素包含在具有样式的元素-ms-overflow-y: auto;(窗口内的可滚动元素)中时,我似乎在位置上受到挑战。

滚动元素时,弹出框不会随之滚动。

我真的希望弹出窗口随此可滚动元素中的内容一起移动。我该如何实现?

弹出代码:

$(this).popover({
            animation: false,
            html: true,
            placement: popover.placement || 'auto bottom',
            title: popover.title,
            content: popover.validationMessage + popover.content,
            trigger: 'manual',
            container: '.content-panel'
}).click(function (e) {
                $('BUTTON[data-toggle="popover"]').each(function (index, element) { $(this).popover('hide'); });
                $(this).popover('show');
                $('#' + $(this).attr('data-for')).focus();
            });
Run Code Online (Sandbox Code Playgroud)

.content-panel 是可滚动的元素。

蝙蝠侠

http://jsfiddle.net/VUZhL/171/

更新资料

我希望弹出窗口继续浮动在其他元素之上。在position:relative;父元素上使用时,它包含弹出窗口,而不是让其浮动在顶部。

我不喜欢这样

我喜欢这样

html javascript jquery twitter-bootstrap twitter-bootstrap-3

5
推荐指数
1
解决办法
5238
查看次数