对于我知道必须采取超过几毫秒的时间的潜力,我用Spin.js它没有任何外部依赖,并且是跨浏览器兼容
var opts = {
lines: 13, // The number of lines to draw
length: 10, // The length of each line
width: 4, // The line thickness
radius: 11, // The radius of the inner circle
rotate: 0, // The rotation offset
color: '#000', // #rgb or #rrggbb
speed: 0.6, // Rounds per second
trail: 32, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
var target, spinner;
$(function(){
target = $('#window').get(0);
spinner = new Spinner(opts);
spinner.spin(target);
setTimeout(function(){
spinner.stop();
$(target).html("Loading finished.");
}, 3500);
});
看到小提琴/y75Tp/73/(更新异步请求感谢verbumSapienti)