All jQuery events are "pass throughs" in the sense you are talking about.
Merely intercepting an event with jQuery does not prevent the normal browser
behavior for that event. If you handle a click event, the browser will still
take its normal action after your code returns.

You can prevent the standard behavior by returning false from your event
handler. (There are also a couple of functions you can use for more specific
behavior - see the docs for details.)

But you're not returning false, are you? So why doesn't the normal link
action take place?

Well, you're assigning e.target into location.href. What is e.target? It's
the <a> DOM element. Assigning that object into location.href certainly
isn't doing any good, and perhaps that error is preventing further action.

If you take out that assignment it may possibly work better.

Or maybe not. I don't know how blockUI works. If it acts immediately, then
it should be fine. If it does anything like a timeout before loading the
message, then it will be too late because the page will have already
navigated.

-Mike

> From: Peter Barney
> 
> Is this a good way to let the user know that a slow-loading 
> page is coming?
> 
>     $("#menu a").click(function(e){
>         $.blockUI({ message: "<h1>Loading...</h1>" });
>         location.href = e.target;
>     })
> 
> I'm not very familiar with jquery, but as far as I can tell, the
> .click() function isn't a pass-through... it seems to stop 
> the click in its tracks. Is this so?
> 
> Peter

Reply via email to