Skip to content

Instantly share code, notes, and snippets.

@marktenney
Forked from offroadkev/functions.php
Last active July 19, 2019 16:39
Show Gist options
  • Save marktenney/435b9cc2e95bad80d8c78099374bdfe7 to your computer and use it in GitHub Desktop.
Save marktenney/435b9cc2e95bad80d8c78099374bdfe7 to your computer and use it in GitHub Desktop.
Change Gravity Forms Spinner to CSS Spinner
// Changes Gravity Forms Ajax Spinner (next, back, submit) to a transparent image
// this allows you to target the css and create a pure css spinner like the one used below in the style.css file of this gist.
add_filter( 'gform_ajax_spinner_url', 'spinner_url', 10, 2 );
function spinner_url( $image_src, $form ) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; // relative to you theme images folder
}
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
/* Spinner */
.gform_ajax_spinner {
margin-left: 20px;
border: 4px solid rgba(255, 255, 255, 0.3);
border-left: 4px solid rgba(110, 73, 217, 0.7);
animation: spinner 1.1s infinite linear;
border-radius: 50%;
width: 30px;
height: 30px;
}
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Spinner from https://tobiasahlin.com/spinkit/ */
.spinner {
margin: 100px auto 0;
width: 70px;
text-align: center;
}
.spinner > div {
width: 18px;
height: 18px;
background-color: #333;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}
.spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}
@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment