Read more

Onload callback for dynamically loaded images

Tobias Kraze
March 22, 2011Software engineer at makandra GmbH

Sometimes you need to dynamically load an image and do something as soon as its loaded (when for example its size is already available).

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

With jQuery, this seems to work across browsers:

$('<img>')
  .attr('src', '')
  .load(function() {
    alert('fully loaded!');
  })
  .attr('src', '/the/real/image/url');
Posted by Tobias Kraze to makandra dev (2011-03-22 22:58)