我正在使用Infinite scroll。我在index.php中以下列方式使用它
echo \yii\widgets\ListView::widget([
'dataProvider' => $dataProvider,
'options' => [
'class' => '.list-view',
],
'itemView' => '_view',
'summary' => false,
'layout' => '{items}<div class="pagination-wrap">{pager}</div>',
'pager' => [
'class' => \darkcs\infinitescroll\InfiniteScrollPager::className(),
'paginationSelector' => '.pagination-wrap',
'pjaxContainer' => $pjax->id,
],
]);
我的_view.php页面
<div class="view media col-sm-6 col-lg-4 job_container">
<div class="widget display-table shadow-z-1 text-center">
<div class="view-info text-left">
<b>Address : </b><?Php echo $locationArray['fullAddress']; ?>
<div class="clearfix"></div>
<b>Owner : </b><?Php echo $ownerName; ?>
<div class="clearfix"></div>
<b>Tenant : </b><?Php echo $tenantName; ?>
<div class="clearfix"></div>
</div>
</div>
</div>
现在当我向下滚动页面时,我得到以下js错误
TypeError:elem.offset(...)未定义var elemTop = 。elem.offset()顶部;
在我的infinitescroll.js
中 function isScrolledToBottom(elem, container) {
var containerViewTop = container.scrollTop();
var containerViewBottom = containerViewTop + container.height();
var elemTop = elem.offset().top; // Here i am getting error
var elemBottom = elemTop + elem.height();
return (elemBottom - options.bufferPx <= containerViewBottom);
}
我已经尝试过很多次了。但我无法获得成功。任何帮助请。
答案 0 :(得分:0)
尝试删除班级名称中的点
'options' => [
'class' => 'list-view',
],