Одновременное скрытие и отображение модального окна bootstrap 4 скроет полосу прокрутки браузера

Я использую Bootstrap 4.0 modal для отображения содержимого. Первое модальное окно довольно длинное, но оно отображает полосу прокрутки браузера. А внутри модального окна у меня есть еще один button для вызова 2nd modal, и он скроет первый модальный. И когда я закрою второй модальный, он вернется к первому модальному, но затем горизонтальная полоса прокрутки браузера исчезнет через 0,5 секунды. Теперь я не могу прокручивать верхнюю или нижнюю часть модального окна, потому что полоса прокрутки исчезла. Есть ли способ предотвратить удаление полосы прокрутки?

Разместите свой код ..

LIJIN SAMUEL 22.05.2018 07:24
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
В JavaScript одним из самых запутанных понятий является поведение ключевого слова "this" в стрелочной и обычной функциях.
Концепция локализации и ее применение в приложениях React ⚡️
Концепция локализации и ее применение в приложениях React ⚡️
Локализация - это процесс адаптации приложения к различным языкам и культурным требованиям. Это позволяет пользователям получить опыт, соответствующий...
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
В настоящее время производительность загрузки веб-сайта имеет решающее значение не только для удобства пользователей, но и для ранжирования в...
Безумие обратных вызовов в javascript [JS]
Безумие обратных вызовов в javascript [JS]
Здравствуйте! Юный падаван 🚀. Присоединяйся ко мне, чтобы разобраться в одной из самых запутанных концепций, когда вы начинаете изучать мир...
Система управления парковками с использованием HTML, CSS и JavaScript
Система управления парковками с использованием HTML, CSS и JavaScript
Веб-сайт по управлению парковками был создан с использованием HTML, CSS и JavaScript. Это простой сайт, ничего вычурного. Основная цель -...
JavaScript Вопросы с множественным выбором и ответы
JavaScript Вопросы с множественным выбором и ответы
Если вы ищете платформу, которая предоставляет вам бесплатный тест JavaScript MCQ (Multiple Choice Questions With Answers) для оценки ваших знаний,...
0
1
46
1

Ответы 1

Я пробовал это, пожалуйста, посмотрите и, если это не сработает, прокомментируйте ниже, чтобы я мог лучше понять, в чем проблема. Это немного искажено здесь, в jsfiddle, я предлагаю вам открыть в коде https://codepen.io/anon/pen/OZqxyK

.modal
{
  overflow:scroll !important;
}
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<link href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel = "stylesheet" />
<script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<button type = "button" class = "btn btn-info btn-lg" data-toggle = "modal" data-target = "#myModal">Open Modal</button>
<div class = "modal fade" id = "myModal" role = "dialog">
  <div class = "modal-dialog">

    <!-- Modal content-->
    <div class = "modal-content" style = "overflow:scroll;">
      <div class = "modal-header">
        <button type = "button" class = "close" data-dismiss = "modal">&times;</button>
        <h4 class = "modal-title">Modal Header</h4>
      </div>
      <div class = "modal-body">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
          desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <br><br>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
          desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <br><br>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
          desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <br><br>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
          desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <br><br>
        <button type = "button" class = "btn btn-info btn-lg" data-toggle = "modal" data-target = "#myModal2">Open Modal</button>
      </div>
      <div class = "modal-footer">
        <button type = "button" class = "btn btn-default" data-dismiss = "modal">Close</button>
      </div>
    </div>

  </div>
</div>
<div class = "modal fade" id = "myModal2" role = "dialog">
  <div class = "modal-dialog">

    <!-- Modal content-->
    <div class = "modal-content">
      <div class = "modal-header">
        <button type = "button" class = "close2 close" data-dismiss = "modal">&times;</button>
        <h4 class = "modal-title">Modal Header</h4>
      </div>
      <div class = "modal-body">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
          It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
          desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        <br><br>
      </div>
      <div class = "modal-footer">
        <button type = "button" class = "close2 btn btn-default" data-dismiss = "modal">Close</button>
      </div>
    </div>

  </div>
</div>

Другие вопросы по теме