0
저는 Ryan Bates의 http://railscasts.com/episodes/114-endless-page-revised과 함께합니다. 맨 아래로 스크롤 한 후에 나타나는 초기 경고 상자는 제대로 작동하지만 이후에는 아무것도 얻을 수 없어 제대로 작동하지 않습니다. index.html.haml무한 스크롤이 작동하지 않습니다.
사진/
#photos
= render @photos
= will_paginate @photos
photos_controller.rb
def index
@photos = Photo.order('created_at DESC').paginate(:per_page => 20, :page => params[:page])
photos.js.coffee
jQuery ->
$(window).scroll ->
if $(window).scrollTop() > $(document).height() - $(window).height() - 50
$.getScript($('.pagination .next_page').attr('href'))
사진 :
의가 살펴 보자 /index.js.erb
$('#photos').append('<%= j render(@photos) %>');
<% if @photos.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@photos) %>');
<% else %>
$('.pagination').remove();
<% end %>
내가 알 수있는 한, 모든 것을 올바르게 설정했지만 페이지의 맨 아래로 스크롤하면 아무 것도로드되지 않습니다. 난 그냥 내 로그에 GET 요청을 만들 것으로 나타났습니다,하지만 아무것도 실제로 브라우저에 나타납니다 ... 어떤 생각?