javascript spinner for grails

岁酱吖の 提交于 2019-12-13 11:24:18

问题


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?


回答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/




回答2:


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

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



来源:https://stackoverflow.com/questions/12218994/javascript-spinner-for-grails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!