Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have a Loading Spinner Animation on top of a Bootstrap Modal

I am trying to have a spinner animation on button click. This Works fine from a page when there is no Bootstrap Modal Open. But when a Bootstrap Modal is Open, the Spinner hides behind the Bootstrap Modal

I have tried this

Expecting the Spinner to be above the Modal Bootstrap

like image 820
shadab momin Avatar asked Aug 20 '19 11:08

shadab momin


People also ask

Which bootstrap component will you use to show loading state in your projects?

Bootstrap “spinners” can be used to show the loading state in your projects. They're built only with HTML and CSS, meaning you don't need any JavaScript to create them.


3 Answers

Change the place of your loadingoverlay. the loadingoverlay has to be in the modal.

Example

Need to also give the setInterval for javascript spinner.

like image 163
xmaster Avatar answered Oct 21 '22 18:10

xmaster


You have to give a bigger z-index to the Loading Spinner, than the Modal's z-index.

Let's try this:

#loadingoverlay {
    position: fixed;
    top: 0;
    z-index: 9999;
    width: 100%;
    height: 100%;
    display: none;
    background: rgba(0,0,0,0.6);
}
like image 38
Feralheart Avatar answered Oct 21 '22 19:10

Feralheart


Provide the z-index value. Thats creating issue

z-index: 9999;

like image 28
Partha Mukherjee Avatar answered Oct 21 '22 19:10

Partha Mukherjee