银色条纹+无限Ajax滚动:无左不断被添加到页面



我有无限ajax滚动运行在一个银条网站。我也有"nonleft"扩展运行,让人们知道,他们到达了底部。

iascroroll在ArticleHolder页面中显示ArticlePages,并按原样显示"nonleft"文本。现在,当我只显示一个ArticlePage直接(没有ArticleHolder周围),它也显示"nonleft"文本。有没有办法把它关掉或限制在某一页?还是我必须从jQuery中解绑定ias ?非常感谢

Silverstripe 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>

当只有一篇文章时,没有#pagination,只有nonleft text

<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>

好了,我找到了。当显示单个ArticlePage时,我仍然在文章周围有一个div with class .post

<div class="post line">
// the article
</div>

一旦infinite ajax scroll看到.postdiv,它就会添加nonleft文本。将.post class div移动到ArticleHolder的循环中有帮助。

ArticleHolder.ss

<div id="posts" class="line">
        <% loop $PaginatedArticles %>
            <div class="post line">
            <% include ArticlePage %>
            </div>
        <% end_loop %>
</div>

相关内容

  • 没有找到相关文章

最新更新