Update to my old 3 column layout template

B

BootNic

I still think that's cool, but I've made efforts to fix it anyway.

It seems to me that it may be caused by repeatedly reassigning the
document.body.onresize event handler, which is a bit of a dumb thing
for my script to have done anyway, so I've made a slight adjustment to
it.

How is it now?
http://examples.tobyinkster.co.uk/3col-new

Have a look at this script. Give it a go and see how it works for you.

It's self contained, no need for that bit of script after the closing
body tag.

http://tinyurl.com/yugyul
http://preview.tinyurl.com/yugyul
 
T

Toby A Inkster

BootNic said:
Have a look at this script. Give it a go and see how it works for you.

I'll give it a whirl, but at first glance it looks a little over-
complicated. From what I can tell, your stability fix is to prevent the
column resize function from being dispatched several times simultaneously
or near-simultaneously.

The font size check is a good idea.
It's self contained, no need for that bit of script after the closing
body tag.

The decision to make my script not self-contained was deliberate. It
avoids hard-coding the element IDs into the javascript file. It also
allows the functions to fire prior to window.onload.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 6 days, 11:11.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/
 
B

BootNic

I'll give it a whirl, but at first glance it looks a little over-
complicated. From what I can tell, your stability fix is to prevent
the column resize function from being dispatched several times
simultaneously or near-simultaneously.

That would be the most important to limit how many times the columns are
resized. It also prevents the columns from being resize if the
documentElement offset Height/Width has not changed.

The main issue is that some browsers fire multiple resize events on one
resizing of the UA.

IE and Opera, if I not mistaken, always fire twice for one resize. That
in its self is not a big issue for just a maximize/restore situation. It
does become an issue when the UA is resized with the mouse, depending on
the speed of the UA resize, it could be something like 50 or more resize
events being fired within a few milliseconds.

I have created a simple example that counts resize events that can be
played with.

Although this example does not do much when a resize event is fired, it
may still be possible to lock up IE.

http://tinyurl.com/yujuf4
http://preview.tinyurl.com/yujuf4
The font size check is a good idea.


The decision to make my script not self-contained was deliberate. It
avoids hard-coding the element IDs into the javascript file. It also
allows the functions to fire prior to window.onload.

The IDs can still be in a separate js file, right off I would suggest an
addition of a global array to hold the ID's and loop through them in
place of setting them in the onload function.

js file for ID's :
var IDs = ['left', 'right', 'main'];

then in colStack change the following:

colStack[0] = document.getElementById('left');
colStack[1] = document.getElementById('right');
colStack[2] = document.getElementById('main');

to:
for (var e=0; e<IDs.length; e++) {
colStack.push(document.getElementById(IDs[e]));
/* If for some reason you would like to avoid the array.push
colStack[e] = document.getElementById(IDs[e])
*/
}

As for the firing before the onload event, I would really be surprised if
the time saved for the effort in this example would exceed 100
milliseconds.
 
T

Toby A Inkster

BootNic said:
As for the firing before the onload event, I would really be surprised
if the time saved for the effort in this example would exceed 100
milliseconds.

Indeed, but if you start adding images, then it becomes more significant.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 7 days, 17:55.]

New BBC Home Page
http://tobyinkster.co.uk/blog/2008/01/07/bbc-home-page/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top