Sucre
Sucre

Reputation: 3

Bootstrap modal switch can't scroll the later modal

I have a modal which has a link to another modal. When I opened the second modal and close the first modal, I can't scroll the second modal, only the background content scrolls. Can any one help me to solve this? I am using bootstrap 3.3.7

Upvotes: 0

Views: 594

Answers (1)

SubjectDelta
SubjectDelta

Reputation: 405

Try to use Modal Events to be sure your modals will not overlap. In this case you must open the second modal after the first one, like this:

$('#first-modal').on('hidden.bs.modal', function(event) {
    // Open your second one in here
});

If .button is the selector for those things that close the first modal to open the second one, you should have something like this

$('#first-modal').on('click', '.button', function() {
    // [...] Whatever you need to do after pushing one of those buttons
    $('#first-modal').on('hidden.bs.modal', function(event) {
        // Open your second one in here
        $('#first-modal').off('hidden.bs.modal');
        // This will remove ANY event attached to 'hidden.bs.modal' label
    }).modal('hide');
});

If you want to use the first cleaner example, oyu should be able to test from the event object where it came from (if it's not one of your button, event.preventDefault(); and quit)

Upvotes: 1

Related Questions