Change backdrop to static for open bootstrap modal

后端 未结 5 2080
感情败类
感情败类 2020-12-19 05:33

Can I change backdrop to \'static\' while my modal is open?

I have modal with form submit button. When I click this button I show loading spinner on my modal and th

5条回答
  •  [愿得一人]
    2020-12-19 05:49

    You can disallow closing of a modal when clicking outside of it, as well as on esc button. For example, if your modal ID is signUp:

    jQuery('#signUp').on('shown.bs.modal', function() {
        jQuery(this).data('bs.modal').options.backdrop = 'static';
        jQuery(this).data('bs.modal').options.keyboard = false;
    });
    

提交回复
热议问题