Quickly make a text spinner for your HTML. Using cli-spinners.
npm install --save el-spinner
Include the javascript
file in your HTML and make a new ElSpinner
:
<script src="/path/to/el-spinner.min.js"></script>
<span id="el"></span>
<script>
const spinner = new ElSpinner({
/* options */
el: document.getElementById('el')
})
spinner.start() // You should manually start the spinner
</script>
You can also use it like this:
import ElSpinner from 'el-spinner'
let spinner = new ElSpinner({
el: document.getElementById('el')
})
spinner.start()
Start the spinner from the first frame.
Stop the spinner.
Resume the spinner.
Toggle the spinner state between stop
and resume
.
Stop the spinner and then remove the text from the element.
Pass a new option to the spinner.
Option | Description | Type | Default |
---|---|---|---|
el | The element where to display the spinner. | Element | - |
type | The type of the spinner. Please check the list | String | 'dots' |
interval | Interval between each frame. If not set, the value from the original spinner will be used | Number | - |