6

I'm using Bootstrap v3.0.2. Want to disable background scrolling when a modal is open. I tried:

.modal-open {
  overflow: hidden;
}

But it isn't working. I found a solution to this problem is:

.modal-open {
    overflow: hidden;
    position:fixed;
    width: 100%;
}

But position: fixed; causing an extra white-space at the bottom of the page in chrome(less than 100% view) and also for large displays(in 100% view) while opening and closing the modal. How to get rid of it? (My modal contains scroll-able fields)

fatCop
  • 2,406
  • 10
  • 33
  • 56

4 Answers4

4

Use height: 100% to make the .modal-open fit the whole screen. Eventually use

top: 0;
left: 0;
right: 0;
bottom: 0;
QUB3X
  • 526
  • 4
  • 17
2

incase anyone having this still, just use

.modal-open {
    overflow: hidden !important;
}

EDIT: have no idea why its de-voted but this is what fixed my issue regarding the scrolling.

ctf0
  • 6,444
  • 5
  • 34
  • 45
0

I had a similar problem, in my case solution was just to update popup

$('#modalWindow').modal('handleUpdate');

My workflow

$('#modalWindow').modal();

$.ajax({

....

success: function(html){

$("#modalWindowContent").html(html);

// great, but height of popup window was changed, let's update it

$('#modalWindow').modal('handleUpdate');

}

});

sukinsan
  • 503
  • 3
  • 14
0

Maybe somebody else will find it helpful. For me for some reason modal-backdrop(faded background) was scrolling together with modal. Finally found that the only way to reproduce this was on Macbook(mavericks/yosemite) built-in screen. If I would move chrome(v44) window to other monitor, background fade would stop moving when scrolling modal.

Sim
  • 13
  • 5