3

我正在尝试在同一页面中使用 Twitter Bootstrap 选项卡和 Bootstrap 弹出框。我很难解决无法超出选项卡限制出现的弹出框的问题(问题是当弹出框出现在边框旁边时,它是半隐藏的)。

我不是 JQuery 方面的专家,但据我了解,问题来自在“iframe”中创建的选项卡,并且弹出框无法从其“iframe”中显示出来。

有什么办法可以解决这个问题吗?(=即使靠近标签的边框也能正确显示弹出框?)

非常感谢!

下面是显示我的问题的示例代码(准备复制/粘贴到 .html http://jsfiddle.net/7PU2D/中):

<!DOCTYPE html>
<head>
    <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
    <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet"> 
</head>
<body>
<div class="span2">
    Left column
</div>
<div class="span6">
    <div class="tabbable">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#tab1" data-toggle="tab">tab1</a></li>
            <li><a href="#tab2" data-toggle="tab">tab2</a></li>
            <li><a href="#tab3" data-toggle="tab">tab3</a></li>
        </ul>

        <div class="tab-content">
            <div id="tab1" class="tab-pane active">tab1 text
                <div class="well">
                    <a href="#" class="btn btn-danger" rel="popover" style="position: relative;" data-content="And here's some amazing content. It's very engaging. right? " data-original-title="A Title">hover for popover</a>
                </div>
            </div>
            <div id="tab2" class="tab-pane">tab2 text</div>
            <div id="tab3" class="tab-pane">tab3 taxt</div>
        </div>
    </div>
</div>

<script src="http://twitter.github.com/bootstrap/assets/js/jquery.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<script>
$(function(){
  $('a[rel=popover]').popover({
      trigger: 'hover',
      placement: 'in bottom',
      animate: true,
      delay: 500,
});
});  
</script>
</body>
4

3 回答 3

4

使用“容器”选项。这样,您可以将弹出框/提示附加到正文元素,它不会被选项卡窗格溢出截断:隐藏...示例:

<script>
$(function(){
   $('a[rel=popover]').popover({
   trigger: 'hover',
   placement: 'in bottom',
   animate: true,
   delay: 500,
   container: 'body'
   });
});  
</script>

或者:

 <a rel="popover" data-container="body">Pop Me Open</a>

您的工具提示仍将正确放置在您的链接旁边,但由于它现在附加到正文标签,它不会被选项卡窗格“半隐藏”。

请参阅引导站点上工具提示/弹出窗口的文档...

2.3.2:

http://getbootstrap.com/2.3.2/javascript.html#popovers

或 3.0

http://getbootstrap.com/javascript/#popovers

于 2013-08-20T19:08:10.710 回答
1

选项卡内容 div 的 css 属性overflow设置为auto(通过 Bootstrap)。这意味着当内容的大小超过 div 的大小时,浏览器会添加滚动条并剪切内容。您可以在您自己的一个 css 文件中将属性覆盖为其默认值 ( visible),或者仅使用如下内联样式:

<div class="tab-content" style="overflow: visible;">

示例:http: //jsfiddle.net/grc4/BXmC3/

于 2012-07-05T11:41:05.707 回答
-1

而不是 $ 使用 jQuery 它可以解决你的冲突。我认为你必须像这样增加标签内容的高度

.tab-content
{
    height:400px;
}
于 2012-07-05T11:30:49.920 回答