シルバーストライプの Web サイトで無限の ajax スクロールを実行しています。また、「NoneLeft」拡張機能を実行して、底に達したことを人々に知らせます。
IAScroll は、ArticleHolder ページに ArticlePages を表示し、「NoneLeft」テキストを表示しています。ここで、ArticlePage のみを (ArticleHolder を使用せずに) 直接表示すると、「NoneLeft」テキストも表示されます。オフにしたり、特定のページに制限したりする方法はありますか? または、ias を jQuery からアンバインドする必要がありますか? ありがとう
シルバーストライプ ArticleHolder.php
<?php
class ArticleHolder extends Page {
private static $allowed_children = array('ArticlePage');
}
class ArticleHolder_Controller extends Page_Controller {
public function PaginatedArticles(){
$paginatedItems = new PaginatedList(ArticlePage::get()->sort("Date DESC"), $this->request);
$paginatedItems->setPageLength(4);
return $paginatedItems;
}
}
script.js
var ias = jQuery.ias({
container: '#posts',
item: '.post',
pagination: '#pagination',
next: '.next',
delay: 0,
negativeMargin: 250,
history: true; }
});
// Adds a text when there are no more pages left to load
ias.extension(new IASNoneLeftExtension({
text: "You reached the end"
}));
複数の投稿が存在する場合の #pagination の html 出力
<div id="pagination" class="line" style="display: none;">
<div class="unit size1of4 lineLeftRight lineLeft">
<p></p>
</div>
<div class="unit size1of4 lineLeftRight lineLeft">
<p> …
<a class="next" href="?start=4"> Next
</a>
</p>
</div>
<div class="unit size1of4 lastUnit lineLeftRight lineRight">
<p></p>
</div>
</div>
記事が 1 つしかない場合、#pagination はありませんが、やはり "NoneLeft" テキストがあります
<div id="ias_noneleft_1403162234904" class="ias-noneleft line">
<div class="unit size1of4 lineLeftRight lineLeft">
<p></p>
</div>
<div class="unit size2of4 lineMiddle">
<p>
You reached the end
</p>
</div>
<div class="unit size1of4 lastUnit lineLeftRight lineRight">
<p></p>
</div>
</div>