Inheritance: extends yii\base\Widget
Example #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->src === null) {
         throw new InvalidConfigException("The parameter src is required by the lazyload widget.");
     }
     static::$counter++;
     if (static::$counter == 1) {
         LazyLoadAsset::register($this->view);
         $this->view->registerJs("\$('.lazy-image').lazyLoad();", View::POS_READY);
         $this->view->registerCss(".lazy-image { display: none; }");
     }
 }