Yii Framework Forum: kop/yii2-scroll-pager + masonry - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

kop/yii2-scroll-pager + masonry How to make kop/yii2-scroll-pager + masonry work together Rate Topic: -----

#1 User is offline   TenderWinner 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-December 15

Posted 28 January 2018 - 06:44 AM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users