In IOS, iframe in a bootstrap modal can not scroll

2019-07-15 04:03发布

问题:

I have an iframe inside a bootstrap modal body:

<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <iframe style="height:500px;"> </iframe>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

When I try to scroll down the iframe here, nothing happens in IOS. (iphone and ipad) Conversely, it perfectly works in Android.

What adjustments should I make to fix this in IOS?

回答1:

Try using -webkit-overflow-scrolling: touch; on modal-body for iOS. It seems to be a common issue.

Source

EDIT OP states that this helped them find their solution.