No description or website provided.
Pull request Compare This branch is 1 commit behind stephenhandley:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README
jquery.anotherinfinitescroll.js

README

use like this:

$('#things').infinitescroll({next: '#next'});


Using it with Rails:

things_controller.rb
======================
def index
  @items_per_page = 25
  @offset = params[:offset] || 0
  @things = Thing.where(:limit => @items_per_page + 1, :offset => @offset)

  if @things.length == @items_per_page + 1
    @things.pop
    @has_more = true
    @next_url = things_url(:offset => @offset + @items_per_page)
  else
    @has_more = false
    @next_url = nil
  end

  respond_to do |format|
    format.html  # this will have the container div and render the partial below into 
    format.json  { 
      render :json => {
        :worked => true,
        :html  => render_to_string(:partial => 'things.html.haml', :collection => @things),
        :has_more => @has_more,
        :next_url => @next_url
      }
    }
  end
end

index.html.haml
=======================
- if @things.length > 0
  #things
    = render(:partial => 'things', :collection => @things})

  = link_to('next', @next_url, :id => 'next')
-else 
  no photos

_things.html.haml
========================
- things.each do |thing|
  = thing.inspect


based off of pieces from 
https://github.com/brianmario/jquery-infinite-scroll
and
https://github.com/paulirish/infinite-scroll


TODO: 
- start hiding next link and add loading indicator
- convert this to markdown