Hey all,
I’ve seen a jQuery plugin called infinite scroll that loads content as you scroll down. ANyone use it with ditto? I would like to integrate it with a blog page that loads all of the child documents inside a container via ditto so that it would load maybe the first chunk in the ditto call but as you scroll down the page it would load the next item and so forth like in the twitter feed where it says "see more messages". This would be great because the initial page would load fast and then more content loads as you scroll down. How would I go about implementing it? Anyone have an example to point to?
-Noah
-
☆ A M B ☆
- 24,524 Posts
Set up the scroller script (it probably has a demo page you can copy the main part from), then use a wrapper snippet in a resource with no template (this will be your AJAX processor; use its URL as the URL argument in the AJAX request) to get the offset passed by the javascript and make a $modx->runSnippet(’Ditto’, array(’parents’=>42, ’offset’=>$offset, ’tpl’=>’ChunkName’, ...); call, and return or echo the Ditto results. Use a chunk for the Ditto tpl to generate the HTML you want as usual.
-
☆ A M B ☆
- 24,524 Posts
no, it’s actually &start. You’d also want the &total for the number to grab each time (5? 10?).
Thanks for your answers guys, and I’m sorry I didn’t say thanks earlier. I will try your method. It seems like something that would be a common use. It will take me a while to figure out and if / when I do I’ll report back. If it is easy for you to implement, I’d love to see how you would / have done it.
Thanks,
Noah
Was the method successful Noah?
Hi Susan,
Are you willing to implement for a bounty? If so what would you charge? Can you include your documentation into the fee so that I’ll be able to understand / use on other projects.
Noah
Hi Cipa,
Thanks for that. I have implemented it on a blog that I built for a client. The question is whether or not you or anyone else knows how to or is willing to for a bounty, integrate the infinitescroll jQuery plugin with ditto to automatically fetch a configurable amount of documents or resources from inside a container as the user scrolls down.
This would decrease load time, and would be cool.
Anyone?
;)
-Noah