簡體   English   中英

保存較少的數據時鼠標光標的更改太快

[英]Change of mouse cursor too fast when saving less data

僅當我在數據庫上保存了許多項目時"cursor", "wait"才會顯示"cursor", "wait" ,但是,如果我僅添加一個數據,則不會顯示"cursor", "wait""cursor", "default"更改"cursor", "default"不會顯示太快了。 這就是我設置光標圖像的方式:有什么我可以編寫的代碼,因此即使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
}

您只能使用javascript中的ajax方法將項目保存到數據庫。 所以,

$( document ).ajaxStart(function() {

    $("body").css("cursor", "wait"); 

 });

$( document ).ajaxComplete(function() {
       $("body").css("cursor", "default"); 

 });

試試這個代碼:

 $(".save").click(function() {
        $( document ).ajaxStart(function() { $("body").css("cursor", "wait"); }).ajaxComplete(function() { 
              $("body").css("cursor", "default"); 
        });

     });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM