Reputation: 32848
I just had an answer on how to do this:
CSS
body.ajaxloading { cursor:wait; }
jQuery
function enableLoadingIcon() {
$(body).addClass('ajaxloading');
}
function disableLoadingIcon() {
$(body).addClass('ajaxloading');
}
However when I try to implement it doesn't seem to work. Can anyone see what the reason is ?
Upvotes: 1
Views: 188
Reputation: 10539
$(body)
is wrong. It is actually $("body")
.
function enableLoadingIcon() {
$('body').addClass('ajaxloading');
}
function disableLoadingIcon() {
$('body').removeClass('ajaxloading');
}
or, even faster, $(document.body)
function enableLoadingIcon() {
$(document.body).addClass('ajaxloading');
}
function disableLoadingIcon() {
$(document.body).removeClass('ajaxloading');
}
Upvotes: 3
Reputation: 1293
Alternatively, you wouldn't have to declare the class in your CSS if you just manually injected the CSS using jQuery like so:
function enableLoadingIcon() {
$(document.body).css ("cursor", "wait");
}
function disableLoadingIcon() {
$(document.body).css("cursor", "auto");
}
Upvotes: 0