Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsizwengubane
15,244 PointsHow to create an endless newsfeed when scrolling down.
I am almost donw with my social network...but having some issues in creating an endless newsfeed of posts where the users can see the old posts while scrolling down
sizwengubane
15,244 Pointsas i told u i am doing everything in php
1 Answer
Christopher Misa
6,467 PointsYou'll need to use a client-side language like javascript to check on the user's scrolling. Some thing like this:
window.onscroll = function() { if(window.scrollY >= (document.body.offsetHeight - window.innerHeight)) { /* request more content probably using AJAX */ } };
I'm not sure if there's a way to do this only using PHP.
Josh Keenan
20,315 PointsAJAX will be needed if you want to do this I think, unless there is a way to do this in PHP but I have never seen something like it. Christopher is right.
sizwengubane
15,244 Pointsgood good...i did it :)
thanks for helping
Josh Keenan
20,315 PointsJosh Keenan
20,315 PointsWhat language are you looking to do this in?