显示进程(或等待)光标,而 jQuery 不起作用

displaying process(or wait) cursor with jquery not working

本文关键字:jQuery 不起作用 光标 进程 等待 显示      更新时间:2023-09-26
$(document).ready(function(){
    //other stuff
    $(".active_item").click(function() {
        $("body").css("cursor", "progress"); //tried wait instead of progress as well
        window.setTimeout(someLength,4000);//just to make sure we do switch back at some point
        $('#list tbody tr').each(function(i) {
            $(this).removeClass('invisible_row');
        });
        $("#list tbody tr").show();
        $('.catnav').each(function(i) {
            $(this).removeClass('current_category');
        });
        $("body").css("cursor", "default");
    });
});

我已经检查了其他问题,例如在javascript/jquery中将光标更改为等待

但是在我的代码中它不起作用(如果我选择那个光标,光标不会更改为" progress"或" wait ")。

您可以尝试使用 show() 函数作为计时器,以便光标至少停留在"进行"一秒钟。

$("#list tbody tr").show(1000//在此处输入您想要的时间, function(){$("body").css("cursor", "default");});

这样,在函数 show() 完成后,您的光标将反转回默认值,这需要 1 秒(在我的示例中)。

您可以查看 .show() 文档以获取更多信息。