/*
Ref:
More ASCII spinners @ http://jsfiddle.net/mnbayazit/CgkQJ/3/
*/
$(document).ready(function() {
// this will autostart spinner
startSpinner();
}); // end .ready function
var timerId // global since outside of functions
function startSpinner() {
if (timerId) return
var spin = "⣾⣽⣻⢿⡿⣟⣯⣷",
char$ = $('#spinner'),
i = 0;
timerId = setInterval(function() {
i = i == spin.length - 1 ? 0 : ++i;
char$.text(spin[i]);
}, 300); // 300 in milliseconds
return;
}
function stopSpinner() {
clearInterval(timerId)
timerId = null
}
function hideSpinner() {
// if hidden, stop spinner
stopSpinner();
$("#spinner").hide("slow", function() {});
}
function showSpinner() {
$("#spinner").show("slow", function() {});
}