JavaScript游标更改(并再次更改) [英] JavaScript Cursor Change (and change back again)
问题描述
我有这个页面做一些时髦的数据库工作需要几秒钟来处理,同时我想设置一个等待
光标所以用户不会翻转并继续单击按钮。我查看了
I have this page that does some funky database stuff that takes a couple seconds to process, and in the meantime I'd like to set a "wait"
cursor so the user doesn't flip out and keep clicking the button. I've looked at the
document.body.style.cursor =wait
事情,这个问题是它只在鼠标位于页面主体上时才起作用(即如果它在按钮上方仍显示正常指针)。如何设置它以便无论鼠标在页面上的哪个位置,它都会显示一个等待图标?
thing, the problem with this is that it only works when the mouse is over the body of the page (i.e. still shows normal pointer if it's over a button). How can I set it so that no matter where the mouse is on the page, it shows a wait icon?
这个问题的第二部分是,一旦完成,它就是事情,我该如何设置回来?如果我将其设置回default
,这似乎会覆盖我设置的任何hover
光标更改我的CSS(所以当它超过指定对象时它不再成为一只手等)。
A second part to this question is, once it's done it's thing, how do I set it back? If I set it back to "default"
, this seems to override any "hover"
cursor changes I had set in my CSS (so it no longer becomes a hand when over a specified object, etc.).
编辑:第一个答案很有效,除了在IE中它在您实际移动光标之前,不会刷新光标(因此您会注意到光标类型的更改)。任何修复?
推荐答案
对于第一个问题,请尝试使用 cursor:wait!important ;
。
For your first problem, try using cursor: wait !important;
.
对于第二个问题,元素的默认光标是 cursor:auto;
,而不是 cursor:default;
或 cursor:inherit;
。
For your second problem, the default cursor for elements is cursor: auto;
, not cursor: default;
or cursor: inherit;
.
这篇关于JavaScript游标更改(并再次更改)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!