【问题标题】:Prevent modal in hiding scrollbar in materializecss防止模态在materializecss中隐藏滚动条
【发布时间】:2018-05-24 02:23:00
【问题描述】:

每当我从 Materializecss 打开一个模式时,滚动条(我的身体有内联滚动条)每次都会隐藏。我应该怎么做,每当我打开一个模态时,身体的滚动条都会保留?

<body>
        <div id="modal_confirm_block" class="modal modal_dialog">
            <div class="modal-content white" id="modal_confirm_co_content" style="padding:0px !important;">
                <div id="div_available" class="center-align" style="padding: 20px !important;"> <i class="material-icons md-12 noselect center-align amber-text darken-4" > warning</i><br>
                    <p style="padding:20px !important;" class="center-align"> Are you sure you want to block this guest? </p>
                </div>
            </div>
            <div class="modal-footer">
                <div class="row" style="margin: 0 !important;">
                    <div class="col s6"> <a href="#!" id="btn_confirm_block" class=" cyan darken-2 white-text modal-action waves-effect waves-white btn" style="width:100% !important;">Confirm</a></div>
                    <div class="col s6">    <a href="#!" id="btn_cancel_block" class="blue-grey darken-4 white-text  modal-action modal-close waves-effect waves-white btn" style="width:100% !important; ">Cancel</a></div>
                </div>
            </div>
        </div>
    </body>

Screenshot before opening a modal
Screenshot when a modal opens. Look at the scrollbar it was removed. And I don't like that because the screen always move.

【问题讨论】:

  • 如果您发布一个有效的 sn-p,也许我们可以提供帮助
  • @MhdAlaaAlhaj 我添加了 2 个屏幕截图。一个在打开模式之前显示滚动条,然后是第二个,当模式打开时滚动条总是消失。
  • 这些链接可能对您有所帮助:Link1,Link2 我知道您正在使用materializecss,这些解决方案适用于引导模式,但我相信这是相同的想法,它可能会有所帮助。

标签: html css materialize


【解决方案1】:

对我来说,它是通过将它放在 css 中来实现的。

body {
   overflow: scroll !important
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-21
    • 2011-12-12
    • 2023-02-17
    • 2014-11-02
    • 2012-03-18
    • 2013-11-04
    • 2011-10-28
    • 2015-03-16
    相关资源
    最近更新 更多