Created
August 23, 2017 09:53
-
-
Save sveetch/aa17058e9e77cba22588222102a47fd7 to your computer and use it in GitHub Desktop.
Sass spinner mixin sample
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
/* | |
* Pure CSS spinner, taken from: | |
* https://stephanwagner.me/only-css-loading-spinner | |
* | |
* You may also see: | |
* https://github.com/loadingio/loading.css | |
*/ | |
@keyframes spinner { | |
to {transform: rotate(360deg);} | |
} | |
/* | |
* Add a simple round spinner | |
* | |
* You should use it in pseudo element, see sample below | |
*/ | |
@mixin add_spinner( | |
$size: 30px, | |
$main-color: #ccc, | |
$alt-color: #07d, | |
$thickness: 1px | |
){ | |
content: ''; | |
box-sizing: border-box; | |
width: $size; | |
height: $size; | |
border-radius: 50%; | |
border: $thickness solid $main-color; | |
border-top-color: $alt-color; | |
animation: spinner .6s linear infinite; | |
} | |
/* | |
* Spinner sample with default parameters | |
.spinner{ | |
&::before { | |
@include add_spinner(); | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment