【问题标题】:x-editable popover not shown completelyx-editable popover 未完全显示
【发布时间】:2013-11-01 19:33:52
【问题描述】:

我正在使用x-editable js。我的 x-editable popover 未完全显示。

我认为 z-index 有问题,我在超链接上尝试过,但没有运气。

<script type="text/javascript">
  $(function () {
    $('.extraSectionTitle').editable({
        success: function (response, newValue) {
            if (response.status == 'error') {
                return response.msg;
            }
        }
    });
    $('.extraSectionDescription').editable({
        success: function (response, newValue) {
            if (response.status == 'error') {
                return response.msg;
            }
        }
    });
  });
</script>

<div class="row-fluid">
  <div class="span7">
    <div class="accordion-body collapse in">
        <div class="row-fluid" id="myDiv">
            <div class="box box-color box-bordered">
                <div class="box-title">
                     <h3><i class="icon-th-list"></i> Hi</h3>

                </div>
                <div class="box-content nopadding">
                    <table class="table table-hover table-nomargin table-bordered">
                        <thead>
                            <tr>
                                <th>Title</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td> 
                                    <a class="editable editable-click extraSectionTitle" data-original-title="Edit Title" data-pk="1" data-type="text" href="#" data-url="#" data-placement="right" title="Edit Title">ASD ASD ASD ASD ASD </a>
                                </td>
                                <td> 
                                  <a class="editable editable-click extraSectionDescription" data-original-title="Edit Description" data-pk="${extra?.id}" data-type="text" href="#" data-url="#" data-placement="right" title="Edit Description">DSA DSA DSA DSA DSA </a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
  </div>
  <div class="span5">
    <div class="box box-color box-bordered">
        <div class="box-title">
             <h3><i class="icon-th-list"></i> Hi</h3>

        </div>
        <div class="box-content nopadding">Hello Hi Hello Hi Hello Hi</div>
    </div>
  </div>
</div>

DEMO FIDDLE

【问题讨论】:

  • 一些代码?你的小提琴不起作用
  • 我已经添加了代码并修复了小提琴。

标签: html css twitter-bootstrap popover x-editable


【解决方案1】:

我知道这有点晚了,但我只是在努力解决这个问题,并以不同的方式解决了它,这可能会帮助其他人。

X-editable 基于 Bootstrap 的 Popover 插件,因此将 container: 'body' 添加到您的 .editable() 设置(或任何其他不在您的 overflow:hidden 元素中的容器)也可以解决此问题。

这很可能只适用于 X-editable 的 Bootstrap 版本,但我没有检查过。

编辑:

只需添加该容器选项..

$('#username').editable({ container: 'body', type: 'text', pk: 1, url: '/post', title: 'Enter username' });

【讨论】:

  • 感谢您的回复。能否请您提供一个有效的jsfiddle,非常有帮助。
  • 这适用于 x-editable 的 bootstrap v2 版本。谢谢
  • container: 'body' 为我修复了它,没有它,按钮和表单字段不会在一行中。
  • 这应该是答案!有人彻底阅读了文档!谢谢
  • 这是完美的,真的应该在他们的文档中。对于具有动态元素的复杂项目,默认情况下,这个花絮是……救命稻草!
【解决方案2】:

您好,问题是提示在表格内并且带有position:absolute,所以他正在寻找最接近的父级position:relative 来定位。

他找到的父级是类.collapse 的div。而这个类有这个属性

overflow:hidden;

您有两个使用 css 的解决方案。

一个在你的 CSS 中输入。启用 div 中溢出的视图。

div.collapse {
 overflow:visible;
}

两个在你的 CSS 中输入。移除此 div 作为相对父级。

div.collapse {
 position:static;
}

你的小提琴http://jsfiddle.net/kGQ2R/6/

【讨论】:

  • 非常感谢您的快速和解释性回答。第二个选项工作正常。 First 也可以,但如果我点击另一个 div,第一个不会折叠/隐藏(我有几个可折叠的 div)。
  • 虽然overflow: visible; 似乎毁了我在手机上的桌子,但两者都在工作。谢谢大佬。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-24
  • 2017-01-20
  • 2011-11-17
  • 1970-01-01
  • 1970-01-01
  • 2023-03-31
相关资源
最近更新 更多