Auto-complete boot body is deleted after opening modal

After open bootstrap modal automatically adds the right: add 19px in the body tag. I want to remove this auto-add. I tried the following code for modal and deleted body auto-wrapping.

<div class="media" data-toggle="modal" data-target="#kolpochitro"> 
             --------
</div>

Then I wrote

<div class="modal fade" id="kolpochitro" role="dialog">
    <div class="modal-dialog modal-sm" >

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
              -------
        </div>
        <div class="modal-body">
              ------
        </div>
      </div>

    </div>
  </div>

After the open modal tag of my body looking at firebug

<body class="cbp-spmenu-push modal-open" style="padding-right: 19px;">

to remove this style I'm trying to use code

$('document').ready(function(){
            $('.media').click(function(){
                $("body").removeAttr("style");
            })
})

But it does not work.

+4
source share
2 answers

Use the feature shown to update it:

$('#modal-content').on('shown.bs.modal', function() {
       $("body.modal-open").removeAttr("style");
 });

Or for a previous version of Bootstrap:

$('#modal-content').on('shown', function() {
        $("body.modal-open").removeAttr("style");
})

For more information check this link.

+3
source

. Javascript, , , , . CSS, , .

body.modal-open {
  padding-right: 0 !important;
}

, , .

+1

All Articles