Thickbox 3.1 escape not working on Firefox 3 Win Xp

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Thickbox 3.1 escape not working on Firefox 3 Win Xp

phipps_73

Hi,

I have a thickbox which is working perfectly apart from when you press
the escape key on win xp running FF3.

Nothing happens. I looked at the code and saw this (keycode 27 is
escape on IE):

document.onkeydown = function(e){
        if (e == null) { // ie
                keycode = event.keyCode;
        } else { // mozilla
                keycode = e.which;
        }
        if(keycode == 27){ // close
                tb_remove();
        } else if(keycode == 190){ // display previous image
                if(!(TB_NextHTML == "")){
                        document.onkeydown = "";
                        goNext();
                }
        } else if(keycode == 188){ // display next image
                if(!(TB_PrevHTML == "")){
                        document.onkeydown = "";
                        goPrev();
                }
        }
};

I think the problem may be on this line:

keycode = e.which;

Should this be:

keycode = e.DOM_VK_ESCAPE;

Has anyone else seen this problem, have a fix?

Cheers,

Dave
Reply | Threaded
Open this post in threaded view
|

Re: Thickbox 3.1 escape not working on Firefox 3 Win Xp

phipps_73

Further to this - the thickbox is an iframe and when the iframe has
focus (e.g. if you highlight some text) the esc button does not work.
If you then click on the header (where the esc text is) then click
escape it works. So I have added the following code to my $
(document).ready(function(){}); :

$(this).keydown(function(e){
        if (e == null) { // ie
                keycode = event.keyCode;
        } else { // mozilla
                keycode = e.which;
        }
        if(keycode == 27){ // close
                top.tb_remove();
        }
});

which is almost the same as the code in the thickbox. This solves the
problem, at least on FF3 on OS X!!

Hope this may prove useful for someone else.

Cheers,

Dave

On Jul 15, 1:13 pm, phipps_73 <[hidden email]> wrote:

> Hi,
>
> I have a thickbox which is working perfectly apart from when you press
> the escape key on win xp running FF3.
>
> Nothing happens. I looked at the code and saw this (keycode 27 is
> escape on IE):
>
> document.onkeydown = function(e){
>         if (e == null) { // ie
>                 keycode = event.keyCode;
>         } else { // mozilla
>                 keycode = e.which;
>         }
>         if(keycode == 27){ // close
>                 tb_remove();
>         } else if(keycode == 190){ // display previous image
>                 if(!(TB_NextHTML == "")){
>                         document.onkeydown = "";
>                         goNext();
>                 }
>         } else if(keycode == 188){ // display next image
>                 if(!(TB_PrevHTML == "")){
>                         document.onkeydown = "";
>                         goPrev();
>                 }
>         }
>
> };
>
> I think the problem may be on this line:
>
> keycode = e.which;
>
> Should this be:
>
> keycode = e.DOM_VK_ESCAPE;
>
> Has anyone else seen this problem, have a fix?
>
> Cheers,
>
> Dave
Reply | Threaded
Open this post in threaded view
|

Re: Thickbox 3.1 escape not working on Firefox 3 Win Xp

richcoto
In reply to this post by phipps_73
Hi guys, i had the same problem, and this is how i solved it...

1. The first think i didn't know is if you're using an iframe to display inside the thickbox you have to use the 'modal=false' like this:

<a href="#TB_inline?height=600&width=700&inlineId=holder&modal=false" class="thickbox" class="cls">0link

2. In order to fixed this permanently you have to modfied the source thickbox.js in the line 245 containing this comparison:

if(!params['modal']){

which is actually not working (i'm using firefox) and replace it with this:

if(params['modal'] != "true"){

And this is it. greetings.
Reply | Threaded
Open this post in threaded view
|

Re: Thickbox 3.1 escape not working on Firefox 3 Win Xp

richcoto
In reply to this post by phipps_73
Hi guys, i had the same problem, and this is how i solved it...

1. The first think i didn't know is if you're using an iframe to display inside the thickbox you have to use the 'modal=false' like this:

<a href="#TB_inline?height=600&width=700&inlineId=holder&modal=false" class="thickbox" class="cls">0link

2. In order to fixed this permanently you have to modfied the source thickbox.js in the line 245 containing this comparison:

if(!params['modal']){

which is actually not working (i'm using firefox) and replace it with this:

if(params['modal'] != "true"){

And this is it.
Reply | Threaded
Open this post in threaded view
|

Re: Thickbox 3.1 escape not working on Firefox 3 Win Xp

richcoto
In reply to this post by phipps_73
Hi guys, i had the same problem, and this is how i solved it... 1. The first think i didn't know is if you're using an iframe to display inside the thickbox you have to use the 'modal=false' like this: <a href="#TB_inline?height=600&width=700&inlineId=holder&modal=false" class="thickbox" class="cls">0link 2. In order to fixed this permanently you have to modfied the source thickbox.js in the line 245 containing this comparison: if(!params['modal']){ which is actually not working (i'm using firefox) and replace it with this: if(params['modal'] != "true"){ And this is it.
Reply | Threaded
Open this post in threaded view
|

Re: Thickbox 3.1 escape not working on Firefox 3 Win Xp

richcoto
In reply to this post by phipps_73
Hi guys, i had the same problem, and this is how i solved it...

1. The first think i didn't know is if you're using an iframe to display inside the thickbox you have to use the 'modal=false' like this:

<a href="#TB_inline?height=600&width=700&inlineId=holder&modal=false" class="thickbox" class="cls">0link

2. In order to fixed this permanently you have to modfied the source thickbox.js in the line 245 containing this comparison:

if(!params['modal']){

which is actually not working (i'm using firefox) and replace it with this:

if(params['modal'] != "true"){

And this is it.