定制 nirvana-msu/yii2-prettyphoto 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nirvana-msu/yii2-prettyphoto

Composer 安装命令:

composer require nirvana-msu/yii2-prettyphoto

包简介

Yii2 extension for prettyPhoto jQuery lightbox clone

README 文档

README

Yii2 widget for prettyPhoto jQuery lightbox clone scaron/prettyphoto

Yii2 extension page

Installation

Composer

First of all, add extension to your composer.json:

{
    "require": {
        "nirvana-msu/yii2-prettyphoto": "1.0.*@dev"
    }
}

Unfortunately, scaron/prettyphoto repository has not been updated in several years and does not contain bower.json which would allow composer to install it.

Instead of copying over the files manually or creating yet another fork just to add bower.json, this extension defines the required repository package inline. Since composer does not inherit "repositories" section, you have to add the same section to your own composer.json:

"repositories": [
        {
            "type": "package",
            "package": {
                "name": "bower-asset/jquery-prettyPhoto",
                "type": "bower-asset-library",
                "version": "3.1.4",
                "source": {
                    "url": "https://github.com/scaron/prettyphoto",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ]

After this just update your dependencies as usual, e.g. by running composer update

##Widget Configuration

  • $target = "a[rel^='prettyPhoto']" string jQuery target selector
  • $pluginOptions = [] array PrettyPhoto plugin options. For more information refer to prettyPhoto documentation

##Sample usage

Rendering widget will produce the necessary javascript code to register plugin.

Using default configuration:

PrettyPhoto::widget();

Customizing some plugin options:

PrettyPhoto::widget([
    'target' => "a[rel^='prettyPhoto']",
    'pluginOptions' => [
        'opacity' => 0.60,
        'theme' => PrettyPhoto::THEME_DARK_SQUARE,
        'social_tools' => false,
        'autoplay_slideshow' => true,
        'modal' => true
    ],
]);

To activate plugin, add rel=”prettyPhoto” attribute for single images and rel="prettyPhoto[gallery-name]” for galleries. These attributes must match target selector as configured by $target property. Refer to prettyPhoto documentation for more examples.

##License

Released under GPL-2.0 license, same as underlying prettyPhoto plugin.

统计信息

  • 总下载量: 1.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-12-11