How to make jQuery show Loading picture while doing开发者_如何学JAVA a function?
I guess you are performing some asynchronous operation. Perhaps $.ajax? Here is a code snippet:
$('<div class="loading">loading ... </div>').appendTo(document.body);
$.ajax({
url: "...",
complete: function () {
$("div.loading").remove();
},
success: function() {
//....
}
}
If you are trying to block the UI while ajax calls are running. You should take a look at jQuery BlockUI. I have used it in a mobile app and it works well. You can add text and gif images to customize the blocking screen.
精彩评论