Endless Scrolling

43 views
Skip to first unread message

Carlos Cibrian

unread,
Jan 31, 2013, 10:32:09 AM1/31/13
to Lift
Hi All

I develop an Endless Scrolling
Do you have some code or example that you can share?
I found this but do not understand how it works:

http://blog.joa-ebert.com/2011/03/07/endless-scrolling-with-lift/

thanks

Tobias Pfeiffer

unread,
Jan 31, 2013, 10:49:02 AM1/31/13
to lif...@googlegroups.com
Hi,
Endless scrolling as in this example consists of two parts:
1. Remember which "page" you are on (on the server),
2. pull new contents from the server when you arrive at the bottom of the
page (in the browser).

What the code you linked to does is:

To achieve (2.): If you scroll down
$(window).scroll(function(){ ...})
and you are on the bottom of the page
if($(window).scrollTop() == ...) { ... }
then call a function on the server
SHtml.jsonCall(containerId, process)._2.toJsCmd
namely the function "process".

The "process" function knows about a var that stores the current "page"
(i.e., set of articles to be sent in one call), then gets the next bunch of
data from the database (this happens in "getItems") and increments this var.
Then, it uses JqJsCmds.AppendHtml to append the HTML for the new items to an
element with a given id in the HTML.

Hope that helps,
Tobias


Henrik Härkönen

unread,
Mar 7, 2018, 1:49:26 AM3/7/18
to Lift
I was searching (just for the fun of it) how to make infinite scroll with lift and found this thread. Also found out that the link to the example is dead, but found it on Wayback Machine:


(Scroll to the "Endless scrolling with Lift" part) 

Maybe this pattern should be stored somewhere, I don't know... But nice example.

-Henrik


Reply all
Reply to author
Forward
0 new messages