Bootstrap свернуть близко - PullRequest
       12

Bootstrap свернуть близко

0 голосов
/ 21 апреля 2020

Привет! Я использовал этот bootstrap код свертки, я хочу, чтобы этот сверток закрывался, когда пользователь нажимал за пределы панели. Я пытался использовать этот скрипт, но он все равно не помог мне с тем, что я ожидал. Может кто-нибудь, пожалуйста, помогите. код

<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#viewmore" aria-expanded="false" aria-controls="collapseExample">
    Open this 
  </button>
</p>
<div class="collapse" id="viewmore">
  <div class="card card-body">
 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.
  </div>
</div>

скрипт

$(document).click(function(e) {
    if (!$(e.target).is('.panel-body')) {
        $('.collapse').collapse('hide');        
    }
});
...