Double scrollbars in bootstrap-4 modal

Viewed 3958

$("div[id^='entry']").each(function(){
  
  var currentModal = $(this);
  
  //click next
  currentModal.find('.btn-next').click(function(){

    currentModal.modal('hide');
    currentModal.closest("div[id^='entry']").nextAll("div[id^='entry']").first().modal('show'); 
     
  });
  
  //click prev
  currentModal.find('.btn-prev').click(function(){
 
    currentModal.modal('hide');
    currentModal.closest("div[id^='entry']").prevAll("div[id^='entry']").first().modal('show'); 

  });

});
    body.animsition.modal-open,body.animsition{
        padding-right: 0!important;
            overflow: hidden!important;

    }
    .modal.fade.show {
        overflow-x: hidden;
        overflow-y: auto;
    }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
     <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#data1">
                   View
                   </button>
                   <p>If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:</p>
     <div class="modal fade" id="data1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog" role="document">
             <div class="modal-content">
                <div class="modal-header">
                   <h3 class="modal-title title" id="exampleModalLabel">Trade Details</h3>
                   <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="card-body card-block">
                      <div class="displaydata">
                         <table class="table table-bordered">
                            <tbody>
                               <tr>
                                  <th scope="col">S.N</th>
                                  <th scope="row">1</th>
                               </tr>
                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
   
                            </tbody>
                         </table>
                      </div>
                   </div>
                </div>
                <div class="modal-footer">
                   <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                   <button type="button" class="btn btn-primary approve"   data-dismiss="modal" data-toggle="modal" data-target="#entry02">Approve
                   </button>
                   <input type="submit" class="btn btn-primary"  value="Edit">
                </div>
             </div>
          </div>
       </div>
       
       <div class="modal fade" id="entry02" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                   <div class="modal-content">
                      <div class="modal-header">
                         <h3 class="modal-title title" id="exampleModalLabel">Pre-Payments/LC's Report Detail</h3>
                                 
                         <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="card-body card-block">
                            <div class="displaydata">
                               <table class="table table-bordered">
                                  <tbody>
                                     <tr>
                                        <th scope="col">Due Date</th>
                                        <th scope="row">21st August</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">As per PI Cash/TT/Advance </th>
                                        <th scope="row">210</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">Incoming/Outgoing LC Number/ Value</th>
                                        <th scope="row">20</th>
                                     </tr>
                                             <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
                                  </tbody>
                               </table>
                            </div>
                         </div>
                         <div class="modal-footer">
                            <button type="button" class="btn btn-default btn-prev">Prev</button>
                            <button type="button" class="btn btn-default btn-next">Next</button>
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                            <input type="submit" class="btn btn-primary"  value="Edit">
                         </div>
                      </div>
                   </div>
                </div>
             </div>
         
          <div class="modal fade" id="entry03" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
             <div class="modal-dialog" role="document">
                <div class="modal-content">
                   <div class="modal-header">
                      <h3 class="modal-title title" id="exampleModalLabel">Sales and Purchase Report Detail</h3>
                              
                      <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="card-body card-block">
                         <div class="displaydata">
                            <table class="table table-bordered">
                               <tbody>
                                  <tr>
                                     <th scope="col">Purchase/Sales Invoice Date</th>
                                     <th scope="row">1st October</th>
                                  </tr>


                               </tbody>
                            </table>
                         </div>
                      </div>
                      <div class="modal-footer">
                         <button type="button" class="btn btn-default btn-prev">Prev</button>
                         <button type="button" class="btn btn-default btn-next">Next</button>
                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                         <input type="submit" class="btn btn-primary"  value="Edit">
                      </div>
                   </div>
                </div>
             </div>
          </div>

I'm having double scrollbar while using bootstrap-4 modal. I've tried all the possible solutions (using jQuery and css)but I'm not able to achieve the result I want.

image

As you can see, there are two scrollbars. Even if I set the body overflow to auto when the modal is closed, and overflow hidden when the modal is open, one scroll bar appears but it shifts to the body content to the right. Since I'm using multiple bootstrap modals, after the multiple bootstrap modal is triggered,the modal-open class on body vanishes.

3 Answers

this is how I solve this issue... i am using this javascript to add and remove the modal-open on the html when I open/close the modal.

jQuery('.modal').on('shown.bs.modal', function (e) {
    jQuery("html").addClass("modal-open");
});
jQuery('.modal').on('hide.bs.modal', function (e) {
    jQuery("html").removeClass("modal-open");
});

for me the html needs to be modal-open that is gives the overflow: hidden; style that hides the scrollbars.

The problem here seems to be "modal-open" class that is not always add to body when you open your next modal (I think it is caused by your hide() & show() action triggered in the same time).

It is that class that remove the scrollbar to your body:

.modal-open {
    overflow: hidden;
}

Maybe I found a solution without touch your functions. My solution say to computer: "Ehi, machine! Every time there are a modal show in a page put a class modal-open in <body>".

To do this I used modal events, you can find the documentation here: https://getbootstrap.com/docs/4.0/components/modal/

I added only this to your script, CSS is not necessary:

$('.modal').on('shown.bs.modal', function (e) {
  $("body").addClass("modal-open");
});

$("div[id^='entry']").each(function(){
     
        var currentModal = $(this);
  
        //click next
        currentModal.find('.btn-next').click(function(){

          currentModal.modal('hide');
          currentModal.closest("div[id^='entry']").nextAll("div[id^='entry']").first().modal('show'); 
           
        });
        
        //click prev
        currentModal.find('.btn-prev').click(function(){
       
          currentModal.modal('hide');
          currentModal.closest("div[id^='entry']").prevAll("div[id^='entry']").first().modal('show'); 

        });
     
    });

    $('.modal').on('shown.bs.modal', function (e) {
      $("body").addClass("modal-open");
    });
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#data1">
                   View
                   </button>
                   <p>If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:</p>
     <div class="modal fade modal-1" id="data1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog" role="document">
             <div class="modal-content">
                <div class="modal-header">
                   <h3 class="modal-title title" id="exampleModalLabel">Trade Details</h3>
                   <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="card-body card-block">
                      <div class="displaydata">
                         <table class="table table-bordered">
                            <tbody>
                               <tr>
                                  <th scope="col">S.N</th>
                                  <th scope="row">1</th>
                               </tr>
                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
   
                            </tbody>
                         </table>
                      </div>
                   </div>
                </div>
                <div class="modal-footer">
                   <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                   <button type="button" class="btn btn-primary approve" data-dismiss="modal" data-toggle="modal" data-target="#entry02">Approve
                   </button>
                   <input type="submit" class="btn btn-primary"  value="Edit">
                </div>
             </div>
          </div>
       </div>
       
       <div class="modal fade" id="entry02" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                   <div class="modal-content">
                      <div class="modal-header">
                         <h3 class="modal-title title" id="exampleModalLabel">Pre-Payments/LC's Report Detail</h3>
                                 
                         <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="card-body card-block">
                            <div class="displaydata">
                               <table class="table table-bordered">
                                  <tbody>
                                     <tr>
                                        <th scope="col">Due Date</th>
                                        <th scope="row">21st August</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">As per PI Cash/TT/Advance </th>
                                        <th scope="row">210</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">Incoming/Outgoing LC Number/ Value</th>
                                        <th scope="row">20</th>
                                     </tr>
                                             <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
                                  </tbody>
                               </table>
                            </div>
                         </div>
                         <div class="modal-footer">
                            <button type="button" class="btn btn-default btn-prev">Prev</button>
                            <button type="button" class="btn btn-default btn-next">Next</button>
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                            <input type="submit" class="btn btn-primary"  value="Edit">
                         </div>
                      </div>
                   </div>
                </div>
             </div>
         
          <div class="modal fade" id="entry03" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
             <div class="modal-dialog" role="document">
                <div class="modal-content">
                   <div class="modal-header">
                      <h3 class="modal-title title" id="exampleModalLabel">Sales and Purchase Report Detail</h3>
                              
                      <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="card-body card-block">
                         <div class="displaydata">
                            <table class="table table-bordered">
                               <tbody>
                                  <tr>
                                     <th scope="col">Purchase/Sales Invoice Date</th>
                                     <th scope="row">1st October</th>
                                  </tr>


                               </tbody>
                            </table>
                         </div>
                      </div>
                      <div class="modal-footer">
                         <button type="button" class="btn btn-default btn-prev">Prev</button>
                         <button type="button" class="btn btn-default btn-next">Next</button>
                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                         <input type="submit" class="btn btn-primary"  value="Edit">
                      </div>
                   </div>
                </div>
             </div>
          </div>

EDIT 1

Maybe I found a good solution! For this I cleaned a little your code, so you can understand better what's going on. I added comments to every function that I wrote. Be carefull, to make it simple I add "data-dismiss" attribute also to next & prev buttons. I removed your loop 'cause it is not necessary here and I created only one onClick event. I tested with Firefox, Chrome and IE11 on Windows and all work well.

Try it and if there is something that you don't understand, let me know in comments. :)

var padding_right,
    currentModal,
    my_block;

$(document).on('shown.bs.modal', '.modal', function () {
  padding_right=$("body").css("padding-right"); /* create a variable with padding-right when modal is shown */
});

$(document).on('hidden.bs.modal', '.modal', function () {
  /* This function is triggered when a modal is hidden and... */
  if($('.modal:visible').length) 
    $(document.body).addClass('modal-open').css("padding-right", padding_right); /* ...if there are some modal visible, it put on body class "model-open" & padding-right */
  else
    $(document.body).removeAttr("style"); /* ...if not remove only style attribute: having put "data-dismiss="modal on button next and prev modal.js automaticaly remove "modal-open" */
});


/* here I created only one function for our buttons, where I change only "my_block" with previus or next one. Your loop is not necessary */
$(".btn-next, .btn-prev").on("click", function(e){
  currentModal = $(this).closest(".modal");
  my_block= ($(this).hasClass("btn-next")) ? currentModal.nextAll("div[id^='entry']").first() : currentModal.prevAll("div[id^='entry']").first();

  my_block.modal('show');
});
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#data1">
                   View
                   </button>
                   <p>If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:If you don't want to download and host Bootstrap 4 yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include jQuery:</p>
     <div class="modal fade modal-1" id="data1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog" role="document">
             <div class="modal-content">
                <div class="modal-header">
                   <h3 class="modal-title title" id="exampleModalLabel">Trade Details</h3>
                   <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="card-body card-block">
                      <div class="displaydata">
                         <table class="table table-bordered">
                            <tbody>
                               <tr>
                                  <th scope="col">S.N</th>
                                  <th scope="row">1</th>
                               </tr>
                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
   
                            </tbody>
                         </table>
                      </div>
                   </div>
                </div>
                <div class="modal-footer">
                   <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                   <button type="button" class="btn btn-primary approve" data-dismiss="modal" data-toggle="modal" data-target="#entry02">Approve
                   </button>
                   <input type="submit" class="btn btn-primary"  value="Edit">
                </div>
             </div>
          </div>
       </div>
       
       <div class="modal fade" id="entry02" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                   <div class="modal-content">
                      <div class="modal-header">
                         <h3 class="modal-title title" id="exampleModalLabel">Pre-Payments/LC's Report Detail</h3>
                                 
                         <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="card-body card-block">
                            <div class="displaydata">
                               <table class="table table-bordered">
                                  <tbody>
                                     <tr>
                                        <th scope="col">Due Date</th>
                                        <th scope="row">21st August</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">As per PI Cash/TT/Advance </th>
                                        <th scope="row">210</th>
                                     </tr>
                                     <tr>
                                        <th scope="col">Incoming/Outgoing LC Number/ Value</th>
                                        <th scope="row">20</th>
                                     </tr>
                                             <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>                               <tr>
                                  <th scope="col">Company</th>
                                  <th scope="row">Mark Company</th>
                               </tr>
                                  </tbody>
                               </table>
                            </div>
                         </div>
                         <div class="modal-footer">
                            <button type="button" class="btn btn-default btn-prev" data-dismiss="modal">Prev</button> <!-- add data-dismiss here to close automatically modals -->
                            <button type="button" class="btn btn-default btn-next" data-dismiss="modal">Next</button> <!-- add data-dismiss here to close automatically modals -->
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                            <input type="submit" class="btn btn-primary"  value="Edit">
                         </div>
                      </div>
                   </div>
                </div>
             </div>
         
          <div class="modal fade" id="entry03" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
             <div class="modal-dialog" role="document">
                <div class="modal-content">
                   <div class="modal-header">
                      <h3 class="modal-title title" id="exampleModalLabel">Sales and Purchase Report Detail</h3>
                              
                      <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="card-body card-block">
                         <div class="displaydata">
                            <table class="table table-bordered">
                               <tbody>
                                  <tr>
                                     <th scope="col">Purchase/Sales Invoice Date</th>
                                     <th scope="row">1st October</th>
                                  </tr>


                               </tbody>
                            </table>
                         </div>
                      </div>
                      <div class="modal-footer">
                         <button type="button" class="btn btn-default btn-prev" data-dismiss="modal">Prev</button> <!-- add data-dismiss here to close automatically modals -->
                         <button type="button" class="btn btn-default btn-next" data-dismiss="modal">Next</button> <!-- add data-dismiss here to close automatically modals -->
                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                         <input type="submit" class="btn btn-primary"  value="Edit">
                      </div>
                   </div>
                </div>
             </div>
          </div>

Have you tried to apply this in your CSS file?

html {
  overflow(x, y): hidden;
}
Related