【问题标题】:Bootstrap Modal Hiding the Scrollbar隐藏滚动条的引导模式
【发布时间】:2015-10-29 16:54:03
【问题描述】:

我正在使用 Bootstrap v3.3.5。每次触发模态框时,滚动条都会隐藏,从而使网页抖动。你能建议我一个修复方法吗?

网址:http://goo.gl/kwn7YH 模态框由右侧的查询按钮触发。我尝试添加 cutsom JS 来删除边距/填充但没有用:

$(document).on( 'hidden.bs.modal', '.modal', function() {
    $(document.body).removeClass( 'modal-scrollbar' );
}).on( 'show.bs.modal', '.modal', function() {
    // Bootstrap's .modal-open class hides any scrollbar on the body,
    // so if there IS a scrollbar on the body at modal open time, then
    // add a right margin to take its place.
    if ( $(window).height() < $(document).height() ) {
        $(document.body).addClass( 'modal-scrollbar' );
    }
});
})(window.jQuery);
});

【问题讨论】:

标签: javascript jquery html css twitter-bootstrap


【解决方案1】:

尝试并使用 $('#myModal').hasClass('in'); 然后在按钮处于活动状态时将 17px 填充应用到按钮的右侧。

【讨论】:

  • 它不只是跳跃的按钮.. 在网站上向下滚动,使导航栏粘在顶部,然后点击按钮,您可以看到整个顶部栏跳跃..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-10
  • 2014-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多