A more browser-compatible way to check for the pressed key code is:

if (!e) var e = window.event;
keycode = e.keyCode || e.which; 

That might work for you, Jim.

m. 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jim Davis
Sent: Tuesday, September 12, 2006 7:51 PM
To: jQuery Discussion.
Subject: Re: [jQuery] ThickBox - closing without using the mouse?

Thanks. I added the code you suggested but couldn't get it to work. It
didn't break anything, but esc didn't close the page. I'll just wait for
2.1.
Jim

On 9/12/06, Su <[EMAIL PROTECTED]> wrote:
> This had been added in 2.1, which was retracted because it had too 
> many issues.
>
>
> In the Thickbox 2.0 file, add this:
>
> $(document).unkeyup();
> $(document).keyup( function(e){ var key = e.keyCode; if(key == 
> 27){TB_remove()} });
>
> after this:
>
>                                 
> $("#TB_closeWindowButton").click(TB_remove);
>
> (that's line 108)
> ..and that should do it.
>
> Standard disclaimer here. I haven't actually put this to use myself,
etc.
>
> That 27 is the escape key. You'll have to consult an ASCII chart if 
> you want it to be something else.
>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to