Skip to content Skip to sidebar Skip to footer

Bootstrap Modal Makes Scrollbar Disappear After Closing

I read a lot of solutions / hacks on this topic on StackOverflow but none of them seem to work for me. I am using a modal for logging in in Meteor (eg. using Facebook login service

Solution 1:

I had the same problem. Bootstrap add modal-open class in the body, but does not remove when the modal is closed. I solved just adding in callback:

$('body').removeClass('modal-open');

Solution 2:

you can try this fix

$(document).on('hidden.bs.modal', '.modal', function () {
    $('.modal:visible').length && $(document.body).addClass('modal-open');
});

Solution 3:

Add this to your body tag style="overflow:auto;"

Solution 4:

 $('body').removeClass("modal-open");

// Bootstrap add modal-open class in the body, but it does not remove when the modal is closed.

Solution 5:

Solve the scroll bar issue by adding the following to your body CSS rules.

I had this same issue and after reading all the answers above they did not solve my issue so I decide to think and I arrive at the fact that forcing the CSS rule will ensure the desired result.

body { padding-right: 0!important }

Post a Comment for "Bootstrap Modal Makes Scrollbar Disappear After Closing"