Modal doesn't show up using bootstrap

江枫思渺然 提交于 2019-12-01 21:01:36

Problem is that jQuery 3.0.0-alpha1 version Not Fully Supported by bootstrap 3.3.5

Reason modal not showing

  • either modal trigger by button using default bootstrap behavior OR
  • opening the modal with jQuery $("#myModal").modal("show")

is because .modal property display:none is not changing to display:block

Fiddle

Solution-1

Switch back to last stable version of jQuery jQuery 2.x

Solution-2 using jQuery 3.0.0-alpha1

Use bootstrap modal event listener and change .modal property from display:none to diaply:block when modal shown.;

If using button to trigger the modal

$(document).ready(function () {
    $("#myModal").on('shown.bs.modal', function () {
        $(".modal").css('display', 'block');
    })
});

Fiddle

If using jQuery to open the modal

$(document).ready(function () {
    $("#myModal").modal("show").on('shown.bs.modal', function () {
        $(".modal").css('display', 'block');
    })
});

Fiddle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!