JSFiddle - React, Tailwind, and code Playground
by John Doe
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<select id="select_data">
<option value="1">Value 1</option>
<option value="2">Value 2</option>
</select>
<div class="loader">
<div style="color: #79bbb5" class="la-ball-spin-fade la-2x">
<div>s</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
CSS
.loader {
display: none;
}
.loader {
width: 48px;
height: 48px;
border-radius: 50%;
position: relative;
animation: rotate 1s linear infinite
}
.loader::before {
content: "";
box-sizing: border-box;
position: absolute;
inset: 0px;
border-radius: 50%;
border: 5px solid #FFF;
animation: prixClipFix 2s linear infinite ;
}
@keyframes rotate {
100% {transform: rotate(360deg)}
}
@keyframes prixClipFix {
0% {clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}
25% {clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}
50% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}
75% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}
100% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}
}
JavaScript
$("#select_data").on('change', function() {
// show spinner here
$('.loader').show();
$.ajax({
url: "test.html"
}).done(function() {
// hide is again on response of ajax
$('.loader').hide();
});
});