Modal not opening in IE

后端 未结 6 1603
野性不改
野性不改 2020-12-01 21:16

I\'m trying to make modals pop up with info about certain places on a map. Here is the code:



        
相关标签:
6条回答
  • 2020-12-01 21:32

    IE so sad. But you can add tag

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    

    on after <html> tag. It's will work. And you should include only bootstrap.min.js. It's enough.

    0 讨论(0)
  • 2020-12-01 21:36

    Here is another solution without modifying initial bootstrap layout and code:

    var $modalWrapper = $('#modalWrapper');
    $modalWrapper.on('show.bs.modal', function () {
        $modalWrapper.toggleClass('in', true);
    });
    $modalWrapper.on('hidden.bs.modal', function () {
        $('.modal-backdrop.fade').remove();
    });
    
    0 讨论(0)
  • 2020-12-01 21:45

    IE does not support the "fade" class for modals, by taking out fade i lost the animation, but the modal displays in all 3 browsers now. I found the answer here: https://github.com/twitter/bootstrap/issues/3672

    0 讨论(0)
  • 2020-12-01 21:46

    You can include transition.js file instead of removing the fade class. This works fine for me with fade effect in IE10

    0 讨论(0)
  • 2020-12-01 21:47

    I was also having same problem today. And after removing the fade class didn't work for me even. Thus, I further inspected and found an issue there. The bootstrap isn't able to add element.style{display:block;padding-right:12px;} (here element means .modal) in IE. And after adding the following css worked fine:

    .modal-open .modal {
      display: block;
    }
    

    Note: I didn't need to remove the fade class. And the animation is also working fine.

    0 讨论(0)
  • 2020-12-01 21:50

    @scalen121 's answer worked for me (the fade animation causes it to break). However, I had a problem with the suggested code fixes..

    If you want to remove the fade animation just for IE (it doesn't seem to work even on IE11) but leave it for other browsers, then you can add the snippet:

    $(function () {
        var isIE = window.ActiveXObject || "ActiveXObject" in window;
        if (isIE) {
            $('.modal').removeClass('fade');
        }
    });
    

    Note that the above IE check is not the same as doing the old: $.browser.msie, which returns undefined on IE11 (tested with jQuery 1.8.3 and 1.7.2).

    0 讨论(0)
提交回复
热议问题