This an example of the whenVisible jQuery/Zepto plugin. You can read more about how the plugin works and how to use it on its Github page. The function of this demo is to load a randomly sized kitten and then reposition the kitten to be centered horizontally and vertically within its parent element, the yellow box. You can load the kitten first and then load the positioning function or load the positiong function first and then load the kitten. Or, for a more realistic example, run them both at the same time. The novelty of the plugin is that it provides a flexible and accurate way to tell when an element is visible on the screen, which can be tricky when dealing with images. A common solution is to use jQuery's .load event method either on the window object or the desired image. However, as the jQuery page explains, there are numerous bugs and gotchas when attempting to monitor image loading. Also, you have to make sure your event handler is registered prior to the image being loaded. The whenVisible plugin takes a much more basic approach to detecting if an element is loaded: it checks to see if the element has a width and height greater than 0. That's it. If the image element meets these conditions, a callback is fired. If not, the plugin will monitor the situation, repeatedly checking at a set interval for any changes. As soon as the image loads, BOOM, callback fired. Otherwise it waits. Eventually, if the element never gains a width and height, it will simply give up. Admittedly, this fills a narrow use case where such a plugin would be necessary. But I needed it, so I built it, and hopefully it can help you at some point. Enjoy!