newerton / yii2-fancybox

fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages. http://fancyapps.com/fancybox/
MIT License
39 stars 32 forks source link

issue when config is empty #1

Closed makroxyz closed 9 years ago

makroxyz commented 10 years ago

I have 3 images on my page, links have rel="fancybox" attribute. without options fancybox always shows first image..

in Fancybox.php I had to modify:

public function run() {
    $view = $this->getView();

    FancyBoxAsset::register($view);

    $config = '';  // <-- edited
    if (!empty($this->config)) {  // <-- edited
        $config = Json::encode($this->config);  // <-- edited
    }  // <-- edited
    $view->registerJs("jQuery('{$this->target}').fancybox({$config});");
}
newerton commented 9 years ago

@makroxyz Sends a pull request.