views:

291

answers:

1

I'm adding an event observer to one image in order to know when it is loaded, it works fine in firefox and safari, but it doesn't work in Opera.

The code is like this

$("element-id").observe("load", myFunction);

I also tried with Event.observe('load', 'element-id', myFunction) and it also works in FF and Safari, but not in opera.

Is there anyway to make it work in Opera?

A: 

My opera version is 9.63 and the src property was set before adding the observer.

What I do is load the image via ajax, but before that I fade out the div containing the image with scriptaculous. And that was the problem.

It seems like fade out also hides the div and Opera is not able to get the image load event. So I fixed it showing the div with opacity 0 on the ajax request onSuccess, this way Opera can get the load event and I can fade in the div with the loaded image.

Thansk anyway for all the aswers.