0.2.6 • Published 6 years ago
el-spinner v0.2.6
el-spinner
Quickly make a text spinner for your HTML. Using cli-spinners.
Install
npm install --save el-spinnerUsage
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()API
methods
constructor(options)
start()
Start the spinner from the first frame.
stop()
Stop the spinner.
resume()
Resume the spinner.
toggle()
Toggle the spinner state between stop and resume.
remove()
Stop the spinner and then remove the text from the element.
set(options)
Pass a new option to the spinner.
options
| 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 | - |