Skip to content

DarkCs/yii2-infinite-scroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Infinite Scroll

LinkPager with infinite scroll support

Installation

php composer.phar require --prefer-dist "darkcs/yii2-infinite-scroll" "*"

Options

$autoStart true;
$containerSelector .list-view;
$itemSelector .item;
$paginationSelector .pagination;
$nextSelector .pagination .next a:first;
$bufferPx 40;
$pjaxContainer null;

Usage example

$pjax = \yii\widgets\Pjax::begin();

echo \yii\widgets\ListView::widget([
    'dataProvider' => $dataProvider,
    'options' => [
        'class' => '.list-view',
    ],
    'itemView' => '_item',
    'summary' => false,
    'layout' => '{items}<div class="pagination-wrap">{pager}</div>',
    'pager' => [
        'class' => \darkcs\infinitescroll\InfiniteScrollPager::className(),
        'paginationSelector' => '.pagination-wrap',
        'pjaxContainer' => $pjax->id,
    ],
]);
\yii\widgets\Pjax::end();

JS usage

// init
$('.list-view').infinitescroll();
// enable, paused by default
$('.list-view').infinitescroll('start');
// disable
$('.list-view').infinitescroll('stop');

Events

$('.list-view').on('infinitescroll:afterRetrieve', function(){
    console.log('infinitescroll:afterRetrieve');
});

$('.list-view').on('infinitescroll:afterStart', function(){
    console.log('infinitescroll:afterStart');
});

$('.list-view').on('infinitescroll:afterStop', function(){
    console.log('infinitescroll:afterStop');
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published