Hourglass cursor appear on whole page

6 views
Skip to first unread message

JoJo

unread,
Nov 17, 2009, 7:30:53 PM11/17/09
to Prototype & script.aculo.us
When the user clicks a button, I want to show an hourglass cursor
while its onclick handler is being run. I tried this:

$$('body').first().setStyle({cursor: 'progress'});

The hourglass only appears when I hover over the body background. When
hovering over the button itself (which is an <a>), the cursor does not
show the hourglass. How do I get the hourglass to appear regardless
of where I'm pointing?

Thanks.

Peter De Berdt

unread,
Nov 18, 2009, 3:12:25 AM11/18/09
to prototype-s...@googlegroups.com
Well, this topic has come up before (I even replied to the thread back then) on the Rails mailing list: http://www.mail-archive.com/rubyonra...@googlegroups.com/msg40330.html

Anyway, I can tell you for sure it doesn't work, it will never work and to be honest, an hourglass cursor is just a bad idea. Cursor changes like that should only be used for blocking events, that's what we're used to from desktop apps. In a web app, there simply are no blocking events. If you really have an action that should prevent the user from doing anything else, you'll have to be more persistent and put an overlay over the whole application, so they really can't click anything. If you're really so fond of using a wait cursor, you can set is as the style for that overlay. For everything else: just use a loading indicator that you show and hide somewhere on the screen.


Best regards


Peter De Berdt


JoJo

unread,
Nov 18, 2009, 4:38:36 PM11/18/09
to Prototype & script.aculo.us
I am making a website with an embedded app, so it is very much like a
desktop application. There are blocking events.

On Nov 18, 12:12 am, Peter De Berdt <peter.de.be...@pandora.be> wrote:
> On 18 Nov 2009, at 01:30, JoJo wrote:
>
> > When the user clicks a button, I want to show an hourglass cursor
> > while its onclick handler is being run. I tried this:
>
> > $$('body').first().setStyle({cursor: 'progress'});
>
> > The hourglass only appears when I hover over the body background. When
> > hovering over the button itself (which is an <a>), the cursor does not
> > show the hourglass.  How do I get the hourglass to appear regardless
> > of where I'm pointing?
>
> Well, this topic has come up before (I even replied to the thread back  
> then) on the Rails mailing list:http://www.mail-archive.com/rubyonra...@googlegroups.com/msg4033...

Peter De Berdt

unread,
Nov 18, 2009, 5:00:23 PM11/18/09
to prototype-s...@googlegroups.com
Although it's very uncommon (and generally bad practice) in a web app to have really blocking events (since users can navigate away from a page or close the window while the request is running), if you really want to do that, you have to make sure the user isn't able to click anything else while the request is being processed. Insert a full window overlay into the document, make sure it indicates that the application can't be used and they must wait. If you insist on the hourglass, just define it in the CSS of the overlay.
Reply all
Reply to author
Forward
0 new messages