Bootstrap 3 modal creates scrollbar when opened

前端 未结 13 1610
遥遥无期
遥遥无期 2020-12-10 03:03

I\'m trying to use Bootstrap for the first time and am having an issue with modal dialogs. Using the example code on this page, when the modal is opened a scrollbar appears,

13条回答
  •  无人及你
    2020-12-10 03:13

    this did a trick for me

    $('html').bind('hidden.bs.modal', function () {
       console.log('hidden');
       $("html").css("margin-right", "0px");
    });
    
    $('html').bind('hide.bs.modal', function () {
       console.log('hiding');
       $("html").css("margin-right", "-15px");
    });
    
    $('html').bind('show.bs.modal', function () {
       console.log('shown');
       $("html").css("margin-right", "-15px");
    });
    

提交回复
热议问题