This version is old school.
Please find jQuery plugins on npm.
whenVisible
by Brad Mallow
A plugin for jQuery/Zepto that repeatedly checks an element's visibility and fires a callback when visible.