Jump to content


Photo

adding items to a div each time the users scrolls down to the end of the div


Best Answer kicken, 07 September 2013 - 02:03 PM

Yes, you would listen for the scroll event, and check what position they are scrolled to. If they have reached the bottom, send an ajax request to get more items then add them to the div.

If you're using jQuery it will simplify the job significantly compared to using the raw api's I linked above. Go to the full post


  • Please log in to reply
2 replies to this topic

#1 phdphd

phdphd

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

Posted 06 September 2013 - 06:38 PM

Hi All,
On my webpage I have a div that scrolls vertically, with a list of items in it. The items in the div come from a php array. I noticed that the building of the div gets slow when there are many items in the array. Since the user might not be interested by the contents of the div, I am considering filling the div by only adding items to it each time the user scrolls down to the end of the div. So basically, each time the user would reach the bottom of the div, the JS code would add items from the php array to the list in the div. Is it possible to implement this ?
Thanks.



#2 kicken

kicken

    Wiser? Not exactly.

  • Gurus
  • 2,775 posts
  • LocationBonita, FL

Posted 07 September 2013 - 02:03 PM   Best Answer

Yes, you would listen for the scroll event, and check what position they are scrolled to. If they have reached the bottom, send an ajax request to get more items then add them to the div.

If you're using jQuery it will simplify the job significantly compared to using the raw api's I linked above.
Recycle your old CD's, don't trash them!
Did I help you out?  Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#3 phdphd

phdphd

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

Posted 10 September 2013 - 09:09 AM

thanks for the info.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com