-2

For now , I have made something like this: tutorial @9lessons.info

which loads data while scrolling down the window and its working fine. But I am trying to get something like: when you scroll a div, then it loads the data.

Please help me to figure this out or direct me to any link which has a tutorial kinda thing which explains how to do a data download and adds this to the DOM while you scroll the div.

Jelmer
  • 2,663
  • 2
  • 27
  • 45
user1846348
  • 241
  • 1
  • 10
  • 22
  • I found this article (thank you Smashing Magazine) and I though that you might find this interesting! http://www.html5rocks.com/en/tutorials/speed/scrolling/ – Jelmer Dec 24 '12 at 12:20

2 Answers2

2

There are a lot of possible solutions. For example you could take the scrollTop of your document and when that reaches the height of the document - viewport height you know you are at the bottom of your page. That is the custom approach in teletubbie-pseudo-code. But maybe you can use a combination of jQuery together with Twitter bootstrap #scrollspy.

Also I found this: How do I make content load when the user scrolls down to it? which has a possible duplicate referring to How to load the web page content based on user scrolling which refers to Loading content as the user scrolls down and Load content as an element scrolls into view and Loading content with ajax while scrolling and Reloading new content while scrolling

Where in the comments the following links can be found:

Maybe that can help you in some way. I am just curious, did you even try to Google it yourself?

edit: I found this article on the Smashing Magazine facebook page which you might find interesting reading.

Community
  • 1
  • 1
Jelmer
  • 2,663
  • 2
  • 27
  • 45
0

You can't do this with PHP alone as the PHP on your server has absolutely no concept of what is happening within the client UI after it has served the page source.

Mike Brant
  • 70,514
  • 10
  • 99
  • 103