I am using Boostrap 3, and I have a modal displaying some HTML content, and it has a scroll bar since all the content is not suitable for viewing. There is a link inside this modal to open another modal. Everything works fine, the second modal opens, but when I close it, the scrollbar disappears and I cannot scroll the first modal (it is also impossible to scroll using the scroll wheel on the mouse). Here is the code for the modals:
<div class="modal fade" id="createVoucherModal" tabindex="-1" role="dialog" aria-labelledby="createVoucherModal" aria-hidden="true"> <div class="modal-dialog" style="width: 800px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Zatvori</span></button> <h4 class="modal-title">Izradi voucher</h4> </div> <div id="voucher-modal-body" class="modal-body" style="margin: 20px 40px 20px 40px;"> </div> <div class="modal-footer"> <a id="modal-create-pdf" href="" target="_blank"><button type="button" class="btn btn-primary" id="">Kreiraj PDF</button></a> <button type="button" class="btn btn-default" data-dismiss="modal">Zatvori</button> </div> </div> </div> </div> <div class="modal fade" id="editVoucherNoteModal" tabindex="-1" role="dialog" aria-labelledby="editVoucherNoteModal" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Zatvori</span></button> <h4 class="modal-title">Uredi bilješke</h4> </div> <div id="voucher-modal-body" class="modal-body"> <textarea style="width: 100%; height: 100px;" id="voucher_note_input"></textarea> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary voucher_note_edit_button">Spremi</button> <button type="button" class="btn btn-default" data-dismiss="modal">Zatvori</button> </div> </div> </div> </div>
The body of the first modal is empty because it is dynamically generated using jQuery, but here is a link to open the second modal
<a href="javascript:;" data-toggle="modal" data-target="#editVoucherNoteModal" id="voucher_note_edit" style="display: none;">Uredi</a>
Images are related since I cannot upload them there without 10 reputation:
Pictures
The first shows the first modal open, in the second picture the second modal is open, and in the third image the second modal is closed and there is no scroll bar.
jquery twitter-bootstrap modal-dialog scrollbar
XploD
source share