Email conversation
From | Karin N. Brown |
To | Me |
Subject | trouble resizing window with perfect popup script |
Date | 20 August 04 02:58 |
Hi,
I tried sending this before, but I suspect that the link contained within
made you ignore it. Anyway, I apologize if you have already read it but I
thought I'd try one more time...
I'm having a small problem with the perfect popups script that is
especially pronounced in Netscape 7. The page I've been testing it on is
at xxx.xxxxxxxx.xxx/xxxxxxxxxxx.xxxx. When I first click on one of the
thumbnails, the window doesn't resize to exactly fit the contents. In IE6
it's just a few pixels taller than it should be; in Netscape it seems to
remain the original 400x500 size. If I leave the popup window open, and
click on another thumbnail (or re-click the same one that's currently open)
the window resizes to what it should be. Also, the problem in Netscape
seems to only happen when I include the <link> tag for the style sheet in
the popup. When that's not there, the popup resizes just fine. I'm sure
I'm just doing something stupid, so I appreciate you taking the time to
help.
Thanks!
--Karin Brown
From | Me |
To | Karin N. Brown |
Subject | Re: trouble resizing window with perfect popup script |
Date | 27 August 2004 00:57 |
Karin,
> I tried sending this before, but I suspect that the link contained within
made you ignore it.
`
Nope, never seen it, nothing to do with a link though, probably just a spam
filter that misfired. Anyway, sorry for the slow reponse this time, been on
holiday.
> In IE6 it's just a few pixels taller than it should be
Only having IE 5.5 to test on this computer ... I see what you mean. Yes
there are a few extra pixels at the bottom. Strangely, this bug does not
appear if I save the page locally and run it here. I think this bug relates
to the other bug. The browser runs the script before the stylesheet is
loaded (while it is using a default font for the caption). The script
completes running and _then_ the stylesheet loads, resizing the caption
font (and hence rezizing the container div), and leaving a few pixels extra
at the bottom. To see how to fix it, see what I put for the other problem.
> in Netscape it seems to remain the original 400x500 size
I note that Opera gets it perfect :)
> problem in Netscape seems to only happen when I include the <link> tag
for the style sheet in the popup.
funny thing is that there is nothing harmful in the stylesheet at all.
nothing that should affect it.
> I'm sure I'm just doing something stupid
would be nice if that was the answer eh? unfortunately not. you seem to be
doing everything just right, but mozilla/NS seems to be failing to make the
DIV available to script until it has loaded the stylesheet. My script's
inbuilt handling of popup blockers (failing without errors) means it gave
you no clue as to what is wrong.
I have seen some research done into this. Basically, because you load the
stylesteet from an external file, the browser does not think the script
should have access to any part of the page until the stylesheet has loaded.
The script runs synchronously, and has to assume that the browser is not
being stupid. Unfortunately, it is being stupid. Sucks huh?
Since you cannot say how long the sheet will take to load, you have a few
options:
1. use inline styles only (the easy way out)
2. adapt the image variant of the script so that it only resizes once
everything is good and ready (you would need to put a fair amount of work
into adapting the script to do this since you also need the space for a
caption)
3. use a timer to wait for a few seconds for the stylesheet to load, since
it should already be in cache anyway from the main page. I don't like this
idea.
I will update the page with some warnings about this.
hope you can get something working.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Karin N. Brown |
To | Me |
Subject | Re: trouble resizing window with perfect popup script |
Date | 29 August 04 06:02 |
Thanks so much for your help! I made the popup use an internal style sheet,
and it seems to have fixed all the problems.
Thanks again.
--Karin
:)