var ft = $('.filter').offset().top; $(window).scroll(function(){ var scrl = $(this).scrollTop()-ft; console.log(scrl); });