Well, when I do this:
window.addEvent('domready',function(){
alert('domready');
// all my code ...
});
window.addEvent('load',function(){
alert('load');
// all my code ...
});
in IE I get load first. I had a function I fired in load that
depended on variables from domready. IE couldn't find them and
subsequently threw an error.
At any rate, I just did this and made it work, feels like a bandaid
but ain't picky.
var domready = false;
var loaded = false;
myFunction(){
// some code
}
window.addEvent('domready',function(){
domready = true;
// all my other code ...
if(loaded) myFunction()
});
window.addEvent('load',function(){
loaded = true
// all my code ...
if(domready) myFunction();
});
So if load goes first then in domready I do my thing.
Alternatively, if domready goes first then in load I do my thing.
Strange things are afoot.
On Feb 15, 9:02 pm, Guillermo Rauch <[email protected]> wrote:
> Well, MooTools should itself add a load event to fire domready if it hasn't
> been fired in my opinion. I thought this was already in place actually
>
>
>
>
>
> On Mon, Feb 16, 2009 at 1:59 AM, rpflo <[email protected]> wrote:
>
> > So in IE7 I'm getting my 'load' function firing before my 'domready'
> > function.
>
> > When you load the page it loads up a bunch of thumbnail images and
> > then when they are all loaded--window.addEvent('load')--I do some
> > things to the interface using variables from my domready function.
>
> > Works great the first time, but if I hit refresh (images are all
> > cashed) IE fires load before domready--and of course the other browser
> > behave as expected.
>
> > Any tips on how to avoid this, or force an order or something?
>
> > Thanks!
>
> --
> Guillermo Rauchhttp://devthought.com