My URL: FunMed | Fun And Innovative Medical solutions | Makers of The FunHaler Inhaler Case

I am trying to do this:

Edit fiddle - JSFiddle

I have the bar pretty much in place, and the styling correct, but I can not get it to function (to fill as you scroll down the page) like it does in the example.


$(window).scroll(function() {

var h = $(document).height();
var s = $(window).scrollTop();
var w = $(window).height();

var t = (s / h) * w;

var p = Math.ceil((s + t) / h * 100) + 1;

$('#progress-bar').width(p + '%');


Can anyone give me a hand with this? I am close, but not quite there. Thanks!