我成功从控制器返回数据
public function index()
{
$posts = Post::with('status' == 'verified)
->paginate(30);
return view ('show')->with(compact('posts'));
}
另外,我成功地展示了我认为的一切:
<div id="content" class="col-md-10">
@foreach (array_chunk($posts->all(), 3) as $row)
<div class="post row">
@foreach($row as $post)
<div class="item col-md-4">
<!-- SHOW POST -->
</div>
@endforeach
</div>
@endforeach
{!! $posts->render() !!}
</div>
到目前为止一切都运行良好。
但是,我根本没有得到官方文档。什么是 'div.navigation
' and '#content div.post
'?就我而言,它们应该是什么?
文档片段:
$('#content').infinitescroll({
navSelector : "div.navigation",
// selector for the paged navigation (it will be ?>hidden)
nextSelector : "div.navigation a:first",
// selector for the NEXT link (to page 2)
itemSelector : "#content div.post"
// selector for all items you'll retrieve
});
编辑:到目前为止我的 Javascript
$(document).ready(function() {
(function() {
var loading_options = {
finishedMsg: "<div class='end-msg'>Congratulations! You've reached the end of the internet</div>",
msgText: "<div class='center'>Loading news items...</div>",
img: "/assets/img/ajax-loader.gif"
};
$('#content').infinitescroll({
loading: loading_options,
navSelector: "ul.pagination",
nextSelector: "ul.navigation a:first",
itemSelector: "#content div.item"
});
});
});
[] 部分创建在页面底部,但无限滚动不起作用。另外,我在控制台中没有收到任何日志或错误。