PDA

View Full Version : Lightbox Body OnLoad Event



silvermarbles
09-16-2010, 01:36 PM
1) Script Title: Lightbox image viewer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/lightbox/index.htm

3) Describe problem: I am trying to load the lightbox viewer when the home page loads which works but for some reason when it does this, it seems to be resizing the image 3 times and then screws the css up. Clicking on the link to load the lightbox works fine but on body load event doesn't work. I have read a previous thread which is closed on how to do this by John.

My script is here. http://www.smartgallery.co.uk/pop.html

Code is here.

<script type="text/javascript">

function initLightbox() { myLightbox = new Lightbox();
var firstLight=document.getElementById('popupfor_toddwhite');
firstLight.onclick.apply(firstLight);
}
Event.observe(window, 'load', initLightbox, false);

</script>

<body onload="initLightbox();">

I have removed any css and still no good.

Any help most appreciated - thanks