【问题标题】:Twitter Bootstrap 3 modal blocking input fields after scrolling botttom?Twitter Bootstrap 3 模式在滚动底部后阻止输入字段?
【发布时间】:2014-11-06 14:28:56
【问题描述】:

我已经搜索过这个问题。我按照这个问题的答案

Twitter Bootstrap modal blocks text input field

但是我的问题仍然存在。

这是我的模态 html

<div class="modal fade" style="display:none;" id="stockPerLocationModal" data-backdrop="static" ng-app="productInventory" ng-controller="ProductInventoryCtrl">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Stock per location</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <table class=" table responsive shopex-table table-hover no-margin">
                            <thead>
                                <tr>
                                    <th>Outlet Name</th>
                                    <th>Stock</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="val in outlets">
                                    <td class="vcenter" ng-model="val.Name">
                                        {{val.Name}}
                                    </td>
                                    <td>
                                        <input type="text" class="form-control" value="{{val.Stock}}" ng-model="val.Stock">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-red" id="btnSaveProductInventory" ng-click="updateProductInventory()">Save</button>
            </div>
        </div>
    </div>
</div>

我在单击按钮时显示此模式。

这里是 JS:

 function showStockPerLocationModal() {
      //  $("html, body").animate({ scrollTop: 0 }, "fast");
        $('#stockPerLocationModal').modal('show');   
    }

我按照答案中的描述添加了事件:

 $('#stockPerLocationModal').on('shown.bs.modal', function () {
           $(document).off('focusin.modal');
        });

但是,当模式打开时,我无法在输入字段中输入文本。

如果我将窗口滚动到顶部。它会起作用的。

所以我在这个函数showStockPerLocationModal中打开模态之前添加了这行代码。

$("html, body").animate({ scrollTop: 0 }, "fast");

页面滚动后 twitter bootstrap 3 modal 阻止输入字段的任何原因?

谢谢。

【问题讨论】:

标签: jquery twitter-bootstrap-3 modal-dialog


【解决方案1】:

检查您的 z-index 和定位。确保模态窗口上的 z-index 高于页面底部的任何元素。应用位置:如果需要,相对于您的模态

【讨论】:

    猜你喜欢
    • 2013-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-05
    • 2013-10-20
    • 2019-03-02
    相关资源
    最近更新 更多