listens to scrolling event and returns the element(s) viewed by scroll.
jQuery 1.7 or later
jQuery library need to be included.Next,include viewedByScroll.js
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="viewedByScroll.js"></script>
$(document).ready(function(){
//select element(s) to check by the scrolling event
$('.viewedByScroll').viewedByScroll({indentTop:0},function(index,element){
///codes
})
});
###.viewedByScroll(settings,callback);
settings [object] configures settings. See .settings()
callback [function] triggers callback when the element is viewed in the viewport. Pass an element and its index
###.settings(object) configures settings
top distance from the viewport
indentTop: 0 //default