首页 > 解决方案 > Bootstrap 4 Modal 无法在 IE 中打开

问题描述

Bootstrap 4 模态在除 Internet Explorer 之外的浏览器上运行良好......我尝试删除淡入淡出类但没有运气,我还尝试了 JS 解决方案

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



  <!-- MODAL -->
<div class="modal fade" id="modal-video" tabindex="-1" role="dialog" 
aria-labelledby="modal-video-label">
<div class="modal-dialog modal-lg" role="document"> 
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" 
aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            <div class="modal-video">
                <div class="embed-responsive embed-responsive-16by9">
                    <video id="sample-video" controls>
                        <source src="video/main.mp4" type="video/mp4">
                        Your browser is not supported
                      </video>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<!--END MODAL -->

仍然没有运气....有人遇到这个并找到一个可行的解决方案???

单击按钮时的控制台错误:

Uncaught Error: Syntax error, unrecognized expression: #
at Function.Sizzle.error (jquery-3.3.1.js:1541)
at Sizzle.tokenize (jquery-3.3.1.js:2193)
at Sizzle.select (jquery-3.3.1.js:2620)
at Function.Sizzle [as find] (jquery-3.3.1.js:845)
at jQuery.fn.init.find (jquery-3.3.1.js:2873)
at new jQuery.fn.init (jquery-3.3.1.js:2983)
at jQuery (jquery-3.3.1.js:139)
at HTMLAnchorElement.<anonymous> (script.js:30)
at HTMLAnchorElement.dispatch (jquery-3.3.1.js:5183)
at HTMLAnchorElement.elemData.handle (jquery-3.3.1.js:4991)

标签: javascriptjqueryhtmlcsstwitter-bootstrap

解决方案


推荐阅读