HTML order load...

Out of context: Reply #4

  • Started
  • Last post
  • 6 Responses
  • monNom0

    I'm not sure the code above will do what you're asking want... looks more like a preloader.

    if you want something like: http://butdoesitfloat.com/

    You need to load images dynamicly only once the image is in view, otherwise you run the risk of a big long queue ahead of the image you need. Jquery might help, but you ought to know a bit of javascript to do it.

    1) parse page for images, capture src, and height parameters in an object and plug into an array.

    2) do something to disable those images so they don't load. (eg: change the src value.)

    in runtime
    3) on scrol: calculate current scroll height, then loop through your array, adding the height of each image and testing to see if that value is greater than the scroll height. If so, switch out the SRC of the image at that index with the proper one from your array and the image will load.

    pretty rough, but ought to work.

View thread