0

I want to create infinite scroll inside twitter bootstrap using kaminari. From what I understand, Kaminari takes a collection of objects (in my case images), and splits them over separate pages.

I am creating the infinite scroll by rendering the "next" link, however, Bootstrap modals don't have pages. So how can I make this work?

Here is the action of clicking on the "Next" link inside the modal:

Started GET "/modal?modal=modals%2Fgallery&page=2&template=modal-gallery" for...
Processing by ApplicationController#raise_not_found as JS
  Parameters: {"modal"=>"modals/gallery", "page"=>"2", "template"=>"modal-gallery", "unmatched_route"=>"modal"}
Ben
  • 2,957
  • 2
  • 27
  • 55
  • I don't think it's possible–because kaminari works with `params[:page]` which means the page parameters must change to go to next page thus a reload. You may be able to do an infinite scroll within the modal however, check this link: https://github.com/amatsuda/kaminari/wiki/How-To%3A-Create-Infinite-Scrolling-with-jQuery . – Bryan Dimas Nov 19 '15 at 05:38
  • This will not work because a Modal does not contain pages. The link you gave me still uses params[:page] to paginate. – Ben Nov 20 '15 at 00:08

1 Answers1

0

I guess infinite scroll will work with 'will_paginate'.

Please see the demo URL - http://sitepoint-infinite-scrolling.herokuapp.com/?page=4

Ref URL - http://www.sitepoint.com/infinite-scrolling-rails-basics/

shiju
  • 26
  • 3