$(function(){ var h=0; $('ul li').each(function(i){ h=$(this).offset().top; }) $(document).scroll(function(){ console.log(h) }) })