简体   繁体   English

在模式twititer-bootstrap中滚动

[英]scrolling in modal twiiter-bootstrap

I have 2 modal in twitter-bootstrap 我在twitter-bootstrap中有2个模态

<body>
<!--very long scrollable content in body-->

first modal with long height: 长高的第一个模态:

<div class="modal fade in" id="adminsetting" data-modal-index="1" tabindex="1" >...</div>

<div class="modal fade in" id="adminsetting2" data-modal-index="2" tabindex="2" >...</div>


</body>

when I call first modal in body section,the modal shows. 当我在主体部分调用第一个模态时,模态显示。 and I can scroll the modal. 我可以滚动模态

again, when I call second modal in first modal (without hide first modal), the second modal shows and I can scroll it. 再次,当我在第一个模态中调用第二个模 (不隐藏第一个模态)时,显示第二个模态,并且可以滚动它。

everything is normal when show modals. 显示模态时一切正常。

But when hide second modal and return to first modal. 但是当隐藏第二个模态并返回第一个模态时。 I couldn't scroll first modal else. 我不能滚动其他模式。 (instead of it the body section will be scroll) (而不是它的主体部分将滚动)

how can fix that problem? 如何解决这个问题?

I found more dynamic code try this 我发现了更多动态代码,请尝试一下

Paste this code into jQuery ready function 将此代码粘贴到jQuery ready函数中

        $('.modal').on('hidden.bs.modal', function () {
            if(($(".modal").data('bs.modal') || {}).isShown){
                $('body').addClass('modal-open');
            }             
        })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM