Created
February 13, 2018 09:08
-
-
Save manuelcoppotelli/86f43435034aa9901939e871c28c5b47 to your computer and use it in GitHub Desktop.
Creates a CSS-only loading spinner.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.is-loading { | |
color: transparent !important; | |
pointer-events: none; | |
} | |
.is-loading:after { | |
-webkit-animation: spinAround 500ms infinite linear; | |
animation: spinAround 500ms infinite linear; | |
border: 2px solid #dbdbdb; | |
border-radius: 290486px; | |
border-right-color: transparent; | |
border-top-color: transparent; | |
content: ""; | |
display: block; | |
height: 1em; | |
position: relative; | |
width: 1em; | |
position: absolute; | |
left: calc(50% - (1em / 2)); | |
top: calc(50% - (1em / 2)); | |
position: absolute !important; | |
} | |
@-webkit-keyframes spinAround { | |
from { | |
-webkit-transform: rotate(0deg); | |
transform: rotate(0deg); | |
} | |
to { | |
-webkit-transform: rotate(359deg); | |
transform: rotate(359deg); | |
} | |
} | |
@keyframes spinAround { | |
from { | |
-webkit-transform: rotate(0deg); | |
transform: rotate(0deg); | |
} | |
to { | |
-webkit-transform: rotate(359deg); | |
transform: rotate(359deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it's a good practice to disable the buttons on click to stop the user from spamming or accidentally pressing the buttons twice while the process is still in progress.
Append to the buttons: