faqts : Computers : Programming : Languages : JavaScript : DHTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

35 of 55 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How do I work around the NN4 resize bug for positioned elements/layers?
What can I do about my positioned elements/layers being lost onresize in NN4?

Sep 21st, 2000 05:40
Christian Tismer, Martin Honnen,


When you resize a window with layers/positioned elements in NN4 (some 
of) your layers are likely to loose their position/show up in the wrong 
place. To work around that reload the document onresize e.g.
  if (document.layers)  // NN4
    window.onresize = function (evt) { location.reload(); };

(but some comments from Chris Tismer :)
The above solution works in general, with the drawback that when
you have a larger page with much initialization, the reload my
become painful for the user. Furthermore, if your page contains
state, this will be lost on your reload, unless you record state
in some other window (using a frameset).

I have been successfully avoiding these problems in some cases.
The necessary changes make cross-browser HTML a bit harder, but
for now this seems to work:

In order to keep your layers alive:
- do not use DIV or SPAN tags, but use LAYER tags. They seem
to survive. You also may create them during the page load
dynamically using document.write, the tags still survive.

In order to keep your formatting correct:
- do no use inline styles on the HTML in your layers! Netscape
will mess them up somehow, and formatting will be lost or appear
on the wrong text after a window resize.
- If you do use inline styles, you may consider to re-assign
all your HTML of your layers after a resize occoured.
- If you can, define a css stylesheet for your layer HTML and place
it into the head section of the document. From the layer HTML text,
refer to the css via the "class" attribute.

If somebody wants to work this further out with me, drop me a note
to tismer@tismer.com .

ciao - chris