0

$("#open_modal").click(function(e) {
  $('#selectMyCats').show();
});

$("#saveSelectCats").click(function(e) {
  $('#selectMyCats').hide();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>


<div class="modal fade" tabindex="-1" id="selectMyCats" aria-labelledby="selectMyCatsLabel" aria-hidden="true" data-bs-backdrop="static">
            <div class="modal-dialog modal-dialog-centered modal-sm">

                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Тестирование</h5>
                    </div>

                    <div class="modal-body">
                        <form class="formAuth" action="javascript:;"></form>
                        <button class="btn btn-sm w-100 mt-2 btn-danger" id="saveSelectCats">Закрыть</button>
                    </div>
                </div>

            </div>
        </div>
        
<div id="open_modal" data-bs-target="#selectMyCats" data-bs-toggle="modal" class="btn btn-primary" >Открыть modal</div>
        

Как видно после закрытия остается затемнение...

Почем так происходит и как это исправить?

1 ответ 1

0

Оказываете решение в том что нужно использовать

$('#selectMyCats').modal('hide');

Вместо

$('#selectMyCats').hide();

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.