1

Infinite scrolling with jQuery

Posted on 25 May 2010 and tagged with ,
I've finally made my first jQuery plugin. This plugin makes it easy to add infinite scrolling to your web application. I know, I know, there is a lot of similar plugins, but i like my twists better . The plugin uses ajax calls to constantly add new content to the page based on the scroll position, as seen on different web 2.0 apps To use this plugin simply: 1. Download the plugin here 2. Add a referenence to jQuery 1.4.x and the plugin in your page<script type="text/javascript" src="/Scripts/jquery-1.4.1.js"></script><script type="text/javascript" src="/Scripts/jquery.infinentscroller.js"></script> 3. Create a region where you want the content to appear<div id="output"></div> 4. Add a page that is resposible to provide the content. It should only return the html you want to append to the region describe above. This current pagenumber will be provided a page number as a query parameter. E.g Data.aspx?page=1 5. Activate the plugin using jQuery syntax below <script type="text/javascript"> <!-- $(document).ready(new function () { $("#output").infinentScroll({ 'url': 'Data.aspx?page={page}' }); }); //--> </script> The final result can look something like this

Disclaimer

© Copyright 2009, Jarle Friestad. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Widget Twitter not found.

Root element is missing.X

Month List