View Full Version : Loading bar help!

03-11-2012, 10:47 PM
Hi everyone,

I am having trouble getting a loading bar to appear from my javascript.

I have the following code in place


var h = $('#footer').height();
var y = $(window).scrollTop();
if( y > (h*0) && y < (h*1.0) ){




I have it so when the user reacher the 'footer' div of the page, new posts appear which are contained in the 'portfolios' container div. They appear fine but no loading bar appears...

The loading bar 'gif' is in the 'loading div id'.

There is a 'display:none;' in the css on the loading div and the portfolios div.

Any reason why the 'loading' div doesn't display but the portfolios does?

I want the loading gif to show whilst the 'portfolios' is loading basically when the user hits the bottom of the page.

Any help would be appreciated!

Thank you!

03-12-2012, 04:52 PM
This line if( y > (h*0) && y < (h*1.0) ){ says; When the scrollTop is greater then zero [that is not at the top of the page] AND it's less then the height of the footer [and that's your error]

The bottom of the page occurs when the window height - footer height is reached. You need to rethink y < (h*1.0).

03-12-2012, 06:49 PM
hats off to 'sunfighter'
Thanked 118 Times in 118 Posts

and you're a 'regular coder'??

something wrong with THAT algorithm!!