Click on the link below and add the codes in a visualforce component name "spinner" or any other name that sound best for you
https://raw.githubusercontent.com/kevanmoothien/sfdc-spinner/master/src/components/spinner.component
Include the Visualforce component on the Visualforce page you want to use the spinner/loading like in the code below.
<apex:page>
<c:spinner />
</apex:page>
To display the spinner, a JavaScript code must be executed. Here are the code
km_spin(true); // to show the spinner
km_spin(false); // to hide the spinner
You can further customize the Spinner by adding some attributes such as in the code below:
<apex:page>
<c:spinner spinner_name="wave" spinner_color="red" />
</apex:page>
Possible value for "spinner_name" are:
- rotating-plane
- wave
- wandering-cubes
- spinner-pulse
- double-bounce
- chasing-dots
- three-bounce
- circle
- cube-grid
- fading-circle
- folding-cube
Value for "spinner_color" is a hex or html color name