[thelist] [javascript] Window.onload > YUI vs. Prototype

Hassan Schroeder hassan.schroeder at gmail.com
Mon Apr 7 15:31:53 CDT 2008


On Sun, Apr 6, 2008 at 8:47 PM, Paul Bennett <Paul.Bennett at wcc.govt.nz> wrote:

>  Well, someone has been clever and done some update work, placing the lightbox includes *above* the common js includes on about 100 pages. The consequence is that lightbox no longer works on these pages, as it seems when window.onload is called the 2nd time it wipes out previous event handlers.(?)

>                 // instantiate lightbox (again)
>                 myLightbox = new Lightbox();

>  This *does* load lightbox again (I've placed some alerts in lightbox.js to check, it *does* find anchors with the right rel attribute, but it doesn't attach event handlers to the anchors. No js errors (firebug is silent) - it just *doesn't work*.

Two ideas, knowing zer0 about Lightbox --

1) Possibly there's some explicit myLightbox.init() that needs to be run?

2) find instances of 'window.onload' and change 'em to a proper listener
     e.g. in Prototype -- Event.observe(window, 'load', do_something);
     so  previous listeners aren't removed.

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder at gmail.com



More information about the thelist mailing list