Hello,
I’m trying to make masonry work with kop/yii2-scroll-pager extension. Tried several ways but with no luck.
My code:
<?php
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => 'grid-item'],
'itemView' => '_item_view',
'options' => ['class' => 'grid'],
'pager' => [
'class' => ScrollPager::className(),
'item' => '.grid-item',
'container' => '.grid',
'triggerOffset'=>10000000,
'enabledExtensions' => ['EXTENSION_HISTORY' => false],
]
]);
I tried to add there:
‘eventOnRender’ => new JsExpression(’\function(items) {\$(".grid").masonry({itemSelector: “.grid-item”, columnWidth: 300, gutter: 5 });’),
but masonry doesn’t work.
if I put:
$this->registerJs(’$(".grid").masonry({
itemSelector: ".grid-item",
columnWidth: 300,
isAnimated: true,
gutter: 5
});’);
then only first page is appears as masonry applied but then it loads just as one column.
Please advise what do I do wrong.