Hi,
i'm pretty new to jquery/javascript, and this bug is affecting my
website...
riccardo, can you please explain your solurion a litle more.. i'm not
getting it.

my code is:

var imageObj = new Image();
$(imageObj).attr("src",imagePath).load(function()
{
//callback function here
});

how shoud I modify that ?
thank you!!!



On Feb 10, 4:07 am, Ricardo Tomasi <[email protected]> wrote:
> Correction:
>
> IE7 is a bit messy. On first load, the .complete property goes from
> 'false' to 'true' correctly and the load event is not fired. However,
> after the image is cached, .complete is always false, readyState is
> always == 'complete' and both readystatechange and load fire. I ended
> up writing an idea for the patch suggested:
>
> (jQuery.fn.) load : function(fn){
>   return fn ?
>     this.is('img') ?
>       this.bind('load readystatechange', function(e){
>         if( this.complete || (this.readyState == 'complete' && e.type
> == 'readystatechange') )
>           fn();
>         })
>     : this.bind('load', fn)
>   : this.trigger('load');
>
> }
>
> Is there any other possible way of implementing this? I'm not aware of
> all the variables involved.
>
> cheers,
> - ricardo
>
> On Feb 9, 4:41 pm, Ricardo Tomasi <[email protected]> wrote:
>
> > What guarantee you have that the image will be loaded in the next
> > 100ms?
>
> > The real fix is simple:
>
> > $('<img/>').bind('load readystatechange', function(){
> >   if (this.complete)
> >      alert('loaded');
>
> > }).attr('src',...).appendTo('body');
>
> > On Feb 8, 10:28 am, Jomange <[email protected]> wrote:
>
> > > try this
> > > $(function(){
> > >      window.setTimeout(
> > >          function mi(){
> > >              $('<img>').load(function()
> > >  { alert ('Not called in IE 6')   }).attr('src',src).appendTo('body');
> > >          }
> > >          ,100
> > >      );
> > >   })
> > > Worked for me
> > > On Jan 19, 7:23 pm, grigori <[email protected]> wrote:
>
> > > > Sample:
>
> > > > <html><head>
> > > > <script src="js/jquery-1.3.min.js"></script>
> > > > <script>
> > > > var src="http://www.google.com/intl/en_com/images/logo_plain.png";;
>
> > > > $(function(){
> > > >     window.setTimeout(
> > > >         function mi(){
> > > >             $('<img>').attr('src',src).appendTo('body').load(function()
> > > > { alert ('Not called in IE 6')   });
> > > >         }
> > > >         ,100
> > > >     );
>
> > > > })
>
> > > > </script>
> > > > </head><body></body></html>
>
> > > > Works in IE7, FireFox, but not in IE 6.
> > > > Is it expectable?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to