Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pure JavaScript spinner
<!doctype html>
<meta charset="utf-8">
<title>Pure JS spinner</title>
#spinner { font-size: 6em; }
var chars = '┤┘┴└├┌┬┐'.split('');
var chars = '⣾⣽⣻⢿⡿⣟⣯⣷'.split('');
var chars = '⠁⠂⠄⡀⢀⠠⠐⠈'.split('');
var chars = '▖▘▝▗'.split('');
function spin() {
var char = chars.shift();
document.querySelector('#spinner').innerHTML = char;
setTimeout(spin, 150);
<div id="spinner"></div>

This comment has been minimized.

Copy link

@luckylooke luckylooke commented Nov 22, 2016

move script to body, because #spinner div is not created yet, so it throws error ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment