bootstrap modal issue in chrome

2019-05-23 18:13发布

I have a bootstrap modal in my asp.net mvc code that it's body bind in runtime. first time I click on the some button and modal work good (body return from controller by jquery ajax).

then must change model’s body dynamically , it works good too(by jquery Ajax and json). then I close modal. second time I click on some button , modal work but with problem . the problem is scrollbar of modal's body is enable but not working , like that the modal is lock . this problem is in chrome , but in IE I have not that. my code for modal :

...
success: function (response) {
$('#myModal').html(response);
$('#myModal').modal({ show: true, backdrop: false, keyboard: false });
...

I change css : overflow:hidden and position:fix but it's not work

2条回答
beautiful°
2楼-- · 2019-05-23 18:28

I got the same problem. I found the solution, but I don't know How It Works. The solution is, add some jquery codes I wrote below.

  $('.modal').bind('shown.bs.modal', function () {
    $(".modal").css("overflow-y", "scroll");
  });
  $('.modal').bind('hide.bs.modal', function () {
    $(".modal").css("overflow-y", "auto");
  });

Good Luck!

查看更多
虎瘦雄心在
3楼-- · 2019-05-23 18:32

the only suggestion is click F12 in chrome and try to debug. but my initial guess is that some CSS standard is diff with two explorer.

查看更多
登录 后发表回答