Javascript Spinner For Grails
I'm trying to add a spinner to an onclick event and I cannot find a pure javaScript spinner. is this possible or is there a better way in grails?
Solution 1:
Pure javascript — not even any images:
document.getElementById("button").onclick = function() {
var spinner = document.getElementById("spinner_container");
spinner.anim_mode = 0;
var animation = ["|", "/", "–", "\\"]
var spin = function() {
spinner.anim_mode = (spinner.anim_mode + 1) % animation.length;
spinner.innerHTML = animation[spinner.anim_mode];
};
spin();
setInterval(spin, 100);
};
Post a Comment for "Javascript Spinner For Grails"