slavkovrn/yii2-imagecarousel

Yii2 扩展使用 jQuery jquery.carousel-1.1.min.js,并从定义的结构 PHP 数组中创建图片轮播。

安装次数: 7,444

依赖: 0

建议者: 0

安全性: 0

星级: 5

关注者: 4

分支: 1

开放性问题: 0

语言:JavaScript

类型:yii2-extension

v1.0.0 2018-01-07 05:59 UTC

This package is auto-updated.

Last update: 2024-09-12 04:36:10 UTC


README

Yii2 扩展使用 jQuery jquery.carousel-1.1.min.js,并从定义的结构 PHP 数组中创建图片轮播。

图片库 PHP 数组生成器.

Image galary

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一

composer require slavkovrn/yii2-imagecarousel

"slavkovrn/yii2-imagecarousel": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

使用方法

在您的视图中设置扩展链接

<?php

use slavkovrn\imagecarousel\ImageCarouselWidget;

?>

<?= ImageCarouselWidget::widget([
    'id' =>'image-carousel',    // unique id of widget
    'width' => 960,             // width of widget container
    'height' => 300,            // height of widget container
    'img_width' => 320,         // width of central image
    'img_height' => 180,        // height of central image
    'images' => [               // images of carousel
        [
                'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image1.jpg',
                'alt' => 'Image 1',
        ],
        [
                'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image2.jpg',
                'alt' => 'image 2',
        ],
        [
                'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image3.jpg',
                'alt' => 'image 3',
        ],
        [
                'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image4.jpg',
                'alt' => 'image 4',
        ],
    ]
]) ?>

向管理员写评论