Yii2 Lazy load Widget for html blocks
Installation (using composer)
composer require gevman/yii2-lazyload
Example
<?php \Gevman\LazyLoad\LazyBlock::begin([
'effect' => \Gevman\LazyLoad\LazyBlock::EFFECT_ZOOM_IN,
'speed' => 600, //default = 600 (time in miliseconds)
'delay' => 10 //default = 0 (time in miliseconds)
]); ?>
<div class="container">
<div class="row">
<div class="col-md-4">
<p><?=\yii\helpers\Html::encode($page->content)?></p>
</div>
<div class="col-md-4">
<p><?=\yii\helpers\Html::encode($page->content)?></p>
</div>
<div class="col-md-4">
<p><?=\yii\helpers\Html::encode($page->content)?></p>
</div>
</div>
</div>
<?php \Gevman\LazyLoad\LazyBlock::end(); ?>
Effects
- EFFECT_SLIDE_UP
- EFFECT_SLIDE_DOWN
- EFFECT_SLIDE_FROM_LEFT
- EFFECT_SLIDE_FROM_RIGHT
- EFFECT_ZOOM_IN
- EFFECT_ZOOM_OUT
- EFFECT_ROTATE
- EFFECT_SKEW
Comments