2

These days, it is common to lazily load images as the user scrolls them into view. I need to lazily load and unload.

Let's say that I have a page with so many large images that the browser gets slow. That part is not changeable. Not all images are visible at once, so I should be able to speed things up by lazily loading the images within the viewport, and lazily unloading the images that are outside of the viewport.

What are some ways to do this? Raw JavaScript or a library like jQuery are both fine.

Jacob Marble
  • 28,555
  • 22
  • 67
  • 78
  • you have the plugin already so what have you tried? – Ibu Apr 10 '13 at 03:49
  • 1
    You can find answers in a similar post [here](http://stackoverflow.com/questions/9653831/is-javascript-able-to-unload-an-image-from-an-html-page). – Dane Hillard Apr 10 '13 at 03:50

1 Answers1

0

Use jquery unload functions for that problem.. http://api.jquery.com/unload/

like

$(window).unload(function() {
  alert('Handler for .unload() called.');
});
manoranjani.a
  • 45
  • 1
  • 1
  • 7
  • manoranjani.a that isn't what he's asking for. He wants to unload images not trigger events when the page is unloaded by surfing to another page. – Rob_vH Aug 28 '14 at 18:46