Skip to content

xjflyttp/yii2-lazyload-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

yii2-lazyload-widget

http://www.appelsiini.net/projects/lazyload

composer.json

"require": {
        "xj/yii2-lazyload-widget": "*"
},

In View

<img class="lazy" data-original="img/example.jpg" width="640" height="480">
use yii\web\View;
use xj\lazyload\LazyloadAsset;
LazyloadAsset::register($this);
$this->registerJs('$("img.lazy").lazyload();'
        , View::POS_READY);

In Assets depends

public $depends = [
    'xj\lazyload\LazyloadAsset',
];