Skip to content

Instantly share code, notes, and snippets.

@gjcourt
Created July 28, 2011 21:33
Show Gist options
  • Save gjcourt/1112620 to your computer and use it in GitHub Desktop.
Save gjcourt/1112620 to your computer and use it in GitHub Desktop.
/**
* When element is visible (has non-zero height), execute callback
*/
function whenVisible(elem, cb) {
(function() {
if (elem.height() !== 0) {
cb();
} else {
setTimeout(arguments.callee, 250);
}
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment