2009/12/5 rtpHarry <rtpha...@gmail.com>:
> I am investigating to see if its possible to track how far down the
> user scrolls on a page.
>
> Ideal situation is track if they got to a percentage of the page
> height like 90% or even if they reached the bottom of the page.

You can do something like this:

$(window).scroll(function(){
  var bottom = $(window).height() + $(window).scrollTop();
  var height = $(document).height();
  var percentage = Math.round(100*bottom/height);
  // do something with percentage
});

Or instead of just checking the percentage you can check if some
element that you are interested in got visible by comparing it's
position on the page to the bottom variable.

Rafał Pocztarski

Reply via email to