Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(window).scroll update issue on dynamic loading content with IE

Status
Not open for further replies.

mike224

Programmer
May 8, 2011
2
GB
I'm trying to get lazy scrolling working in IE

There are jQuery libraries for this (but its fairly simple, extra libraries aren't needed)

What I want to do, is add to the inner when the vertical scroll bar gets to about 75% from the top. The method I use is:


Code:
jQuery(window).scroll(function(){
	if  (jQuery(window).scrollTop() > ((jQuery(document).height() - jQuery(window).height())*0.75)){
		loadSection(); // a function that dynamically adds to the innerHTML
    } 
});

This seems to work fine in FireFox and Chrome, but in IE once we get to the 75% position, the vertical position/value doesn't seem to update after dynamically loading in the content.

When this happens in IE, all of the data gets loaded in (since after loading in the innerHTML section, IE thinks the scroll bar is still at ~75%). Sometimes this will result in all of the content being loaded in one go.

Does anyone know a work around to stop IE from doing this?

You can see this happening here:
(it still looks a bit ugly, since I need to update the css)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top