Bootstrap modal issue on Safari/iOS/iPhone

后端 未结 4 1273
闹比i
闹比i 2020-12-03 17:58

Bootstrap modal fade is working perfectly on Chrome/Internet Explorer, but it doesn\'t work on the iPhone/Safari. Does someone a solution for this issue?

&l         


        
相关标签:
4条回答
  • 2020-12-03 18:39

    I had the same problem these days and figured out, that safari on iOS is working differently to other browsers with respect to one thing. The modal window is not shown on safari but on many other browsers, when there is a href="#" missing.

    not working on Safari/iOS but other browsers:

    <li><a data-toggle="modal" data-target="#testModal">Modal</a></li>
    

    working on Safari/iOS and other browsers:

    <li><a href="#" data-toggle="modal" data-target="#testModal">Modal</a></li>
    
    0 讨论(0)
  • 2020-12-03 18:44

    Change transition: all .3s ease; to transition: opacity .3s ease, transform .3s ease; this fixed my issue.

    0 讨论(0)
  • 2020-12-03 18:56

    I found this answer that solved the problem for me. The problem is that iOs doesn't realize that the tag is clickable.

    Create a CSS style as follows:

    .clickable {
        cursor: pointer;
    }
    

    In your modal code, add the clickable class:

    <li><a data-toggle="modal" class="clickable" data-target="#modalDelete">Delete</a></li>
    
    0 讨论(0)
  • 2020-12-03 19:01

    If you make the 'a' tag an 'button' instead, it's working in both safari IOS and desktop browsers.

    <li><button data-toggle="modal" data-target="#testModal">Modal</button></li>
    
    0 讨论(0)
提交回复
热议问题