Skip to content Skip to sidebar Skip to footer

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);
};​

http://jsfiddle.net/dGL8X/

Solution 2:

This is my favorite go-to spinner. JS/CSS, no images. Has fallback for crappy browsers ;)

http://fgnass.github.com/spin.js/

Post a Comment for "Javascript Spinner For Grails"