HTML: Changing default cursor does not work until pointer is moved

I have an overlayWaitDiv defined as follows with CSS:

#overlayWaitDiv {
    cursor:   wait;
    position: fixed;
    top:      0;
    left:     0;
    width:    100%;
    height:   100%;
    z-index:  99;
}

The idea is that this overlay is put on top of the other elements, taking all window space, and shows a wait cursor.

I am showing/hiding this by using the following HTML:

To display the overlay:

<div id="overlayWaitDiv" style></div>

To hide the overlay:

<div id="overlayWaitDiv" style="display: none; "></div>

This is working fine: the cursor is changing from normal to wait, and back, according to the events happening in my page. The only problem that I have is that, in order for this cursor switch to happen, the user needs to move the pointer.

How can I make the browser immediately change the pointer, without the need for the user to move it?

Answers


put cursor:auto; then it will ok


Try setting the cursor value using java script as shown below.

$("#overlayWaitDiv").css("cursor","wait") ;

Why don't you try add a class to the body tag? Like this:

.waiting {
   cursor: wait;
}

When you need to show the waiting cursor use $("body").addClass("waiting") and $("body").removeClass("waiting") to hide.


Need Your Help

I have three different websites and I want to create a single entry point for all of them but how?

asp.net sql-server cookies user-accounts

We are creating three different websites using asp.net but for the user part we want to implement an approach so that each user only need to create an account in any of these three sites but use th...

Converting Member Function Pointer to TIMERPROC

c++ winapi casting member-function-pointers

How do I convert a member function pointer to the TIMERPROC type for use with the WINAPI SetTimer? The code snippet below shows how I'm doing it now, but when I compile I get this error:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.