...

View Full Version : Loading bar help!



jbyrne
03-11-2012, 09:47 PM
Hi everyone,

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

I have the following code in place



$(document).ready(function(){
$(window).scroll(function(){

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

$('#loading').fadeIn("slow");
$('#loading').delay(10000).fadeOut();

$("#portfolios").delay(1000).fadeIn("slow");

}
});
})


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!

sunfighter
03-12-2012, 03: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).

swiper
03-12-2012, 05:49 PM
hats off to 'sunfighter'
<<
Thanked 118 Times in 118 Posts
>>

and you're a 'regular coder'??

something wrong with THAT algorithm!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum