I need to display records in a Twitter BootStrap Modal. I also need to implement infininte-scrolling so that when user scrolls to bottom of the modal, it fetches more records.
I created a demo based on How To: Create Infinite Scrolling with jQuery wiki of Kaminari which uses infinite-scroll jQuery plugin.
Here is how I configured it
Modal HTML
<div tabindex="-1" role="dialog" id="mediaLibraryModal" class="modal fade" aria-labelledby="exampleModalLabel">
<div role="document" class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" class="close" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 id="exampleModalLabel" class="modal-title">Media Library</h4>
</div>
<div class="modal-body">
<div id="media-images">
<div class="page">
<p class='media-image'><img src='...'/></p>
<p class='media-image'><img src='...'/></p>
. . .
</div>
</div>
<div id="paginator"></div>
</div>
</div>
</div>
</div>
coffee script to enable autoscrolling
$(document).ready ->
$("#media-images .page").infinitescroll
navSelector: "ul.pagination" # selector for the paged navigation (it will be hidden)
nextSelector: "ul.pagination a[rel=next]" # selector for the NEXT link (to page 2)
itemSelector: "#media-images p.media-image" # selector for all items you'll retrieve
CSS
#mediaLibraryModal .modal-dialog .modal-body {
max-height: 420px;
overflow-y: auto;
}
It works perfectly for normal pages. It loads more records as user scroll to end of page but same doesn't work with Twitter BootStrap Modal.
It seems it must related to height of window or modal but I am not css guy. Can anybody please guide how to fix it?