Created
August 17, 2013 17:32
-
-
Save jiripudil/6257923 to your computer and use it in GitHub Desktop.
Pure JavaScript spinner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Pure JS spinner</title> | |
<style> | |
#spinner { font-size: 6em; } | |
</style> | |
<script> | |
var chars = '┤┘┴└├┌┬┐'.split(''); | |
var chars = '⣾⣽⣻⢿⡿⣟⣯⣷'.split(''); | |
var chars = '⠁⠂⠄⡀⢀⠠⠐⠈'.split(''); | |
var chars = '▖▘▝▗'.split(''); | |
function spin() { | |
var char = chars.shift(); | |
document.querySelector('#spinner').innerHTML = char; | |
chars.push(char); | |
setTimeout(spin, 150); | |
} | |
spin(); | |
</script> | |
</head> | |
<body> | |
<div id="spinner"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
move script to body, because #spinner div is not created yet, so it throws error ;)