jQuery onVisible plugin : add on visible event
onVisible depends on jQuery. Include them both in end of your HTML code:
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.onvisible.js" type="text/javascript"></script>
then in your code do:
$(".foo").listenPosition().on('visible',function(){
$(this).html("Hello");
});
This causes all elements of class foo to be initialized.
You can install with bower.
$ bower install jquery-onvisible
All code licensed under the MIT License. In other words you are basically free to do whatever you want. Just don't remove my name from the source.