do sprawdzenia
–
//if user scroll to bottom of grid $('#grid').on('scroll', function() { if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) { alert('end reached'); } })
–
detekcja czy element jest widoczny w oknie, w kodzie strony:
<div id="log"></div> <div id="scroll">Scroll Down</div>
oraz w skrypcie:
function log(txt) { $("#log").html("location : <b>" + txt + "</b> px") } $(function() { var eTop = $('#scroll').offset().top; //get the offset top of the element log(eTop - $(window).scrollTop()); //position of the ele w.r.t window $(window).scroll(function() { //when window is scrolled log(eTop - $(window).scrollTop()); }); });
–
Hope this helps and happy coding :)