I have a question regarding Bootstrap 4 and a simple trick I am trying to implement. I am looking to display a Loading indicator similar to Twitter every time the user opens the modal. I have some code that is working well, but I seem to have misplaced some pieces...
Button HTML Codes :
<a href="#example_Modal" role="button" data-toggle="modal" data-target="#example_Modal">Click here</a>
Modal HTML Codes
<div class="modal fade" id="example_Modal" tabindex="-1" role="dialog" aria-labelledby="example_ModalLabel" aria-hidden="true"data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" role="document">
<div class="modal-content">
<!-- Preloader -->
<div id="modal-preloader">
<div class="modal-preloader_status">
<div class="modal-preloader_spinner">
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status"></div>
</div>
</div>
</div>
</div>
<!-- End Preloader -->
<div class="modal-body"></div>
<div class="modal-footer"></div>
</div>
</div>
</div>
Jquery Codes
$('#example_Modal').on('shown.bs.modal', function () {
$("#modal-preloader").delay(5000).fadeOut(100);
});
It seems the loading indicator spinner only shows once when the modal is opened, but I would like it to display each time the user closes and reopens the modal. I hope that explanation clarifies my issue. Thank you.