2

When using fullscreen image gallery and blending between pictures, some images are much bigger and takes some time to load and show up.

Yes, there is a function called onload which is called when image is loaded. Unfortunately, if image is really high quality, it takes some time to show up or render after load event.

My question is, how can I get know when image is rendered/showed up so I can do proper blending ? When blending .. old image fades out, then I change an image and then I fade a new image in. Unfortunately, if image takes some time to show, it fades "nothing" in and then image will show up immediately.

Kromster
  • 7,181
  • 7
  • 63
  • 111
wh1sp3r
  • 1,640
  • 2
  • 17
  • 30
  • 2
    Are you already waiting for `onload`? I would assume that's the best you can do. – John Dvorak Dec 23 '13 at 19:02
  • The only option is onload, the image doesn't load faster if you use something else, the only way to make that happen is to optimize your images. – adeneo Dec 23 '13 at 19:04
  • Use progressive jpegs, they work great for displaying images while downloading. – David Hellsing Dec 23 '13 at 19:05
  • David: downloading/loading is not a problem. Problem is, it takes some time to show image up after onload function was fired. – wh1sp3r Dec 23 '13 at 19:10
  • Maybe try loading the next image while the user is viewing the current one, so the majority of the time the next image is pre-loaded when the transition is going to occur. – DBS Dec 24 '13 at 13:17
  • I just figured my problem. Actually it was not my problem, but it seems, onload is not working correctly in IE11. I tried firefox and it's working as it should. – wh1sp3r Dec 25 '13 at 16:58

2 Answers2

0

With jquery:

 <img src="book.png" alt="Book" id="book">

 $( "#book" ).load(function() {
  // Handler for .load() called.
});
phirschybar
  • 8,357
  • 12
  • 50
  • 66
0

Use

$(window).load(function(){})

This will fire after all pictures have been loaded. See this.

Community
  • 1
  • 1
Justin
  • 885
  • 9
  • 19
  • yes, that's working, unfortunately, when image is loaded, it still takes some time to SHOW UP :) – wh1sp3r Dec 23 '13 at 19:10