这适用于jquery 1.8
$(function() {
var $loader = $("#loading-indicator"),
timer;
$("#loading-indicator").css('visibility','hidden').ajaxSend(function() {
timer && clearTimeout(timer);
timer = setTimeout(function() {
$loader.css('visibility','visible');
}, 50);
}).ajaxComplete(function() {
clearTimeout(timer);
$loader.css('visibility','hidden');
});
});
#loading-indicator
只是没有出现..
哪些方法在1.10更改?
答案 0 :(得分:1)
解决了
$(function() {
var $loader = $("#loading-indicator"),
timer;
$loader.css('visibility','hidden');
$(document).ajaxSend(function() {
timer && clearTimeout(timer);
timer = setTimeout(function() {
$loader.css('visibility','visible');
}, 50);
}).ajaxComplete(function() {
clearTimeout(timer);
$loader.css('visibility','hidden');
});
});
从1.8开始,ajaxStart应附加到文档中.. 在1.8.3它确实有用..嗯