简体   繁体   中英

scrolling in modal twiiter-bootstrap

I have 2 modal in twitter-bootstrap

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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