[英]Change of mouse cursor too fast when saving less data
"cursor", "wait"
only shows when i save many item on the database, however, if i only add one data,changing of "cursor", "wait"
to "cursor", "default"
doesnt not show because the process is too fast. 仅当我在数据库上保存了许多项目时
"cursor", "wait"
才会显示"cursor", "wait"
,但是,如果我仅添加一个数据,则不会显示"cursor", "wait"
到"cursor", "default"
更改"cursor", "default"
不会显示太快了。 this is how i set my cursor image : Is there anything that i can code,so the changing of cursor will be seen by the GUI user even he saved only one item(saving too fast csenario). 这就是我设置光标图像的方式:有什么我可以编写的代码,因此即使GUI用户只保存了一项,光标的更改也将由GUI用户看到(保存速度太快)。
$(".save").click(function() {
$("body").css("cursor", "wait");
save();
});
function save(){
///saving to database and other happens here
$("body").css("cursor", "default");
//end of saving process here
}
You can save items to database only using ajax method from javascript. 您只能使用javascript中的ajax方法将项目保存到数据库。 So,
所以,
$( document ).ajaxStart(function() {
$("body").css("cursor", "wait");
});
$( document ).ajaxComplete(function() {
$("body").css("cursor", "default");
});
Try this code: 试试这个代码:
$(".save").click(function() {
$( document ).ajaxStart(function() { $("body").css("cursor", "wait"); }).ajaxComplete(function() {
$("body").css("cursor", "default");
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.