raoul2000 / yii2-backstretch-widget
Backstretch jQuery插件的包装器
1.0.1
2014-10-28 15:07 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-24 07:17:06 UTC
README
这个yii2扩展是对jQuery Backstretch插件的包装。
安装
安装此扩展的首选方法是使用composer。
运行以下命令:
php composer.phar require --prefer-dist raoul2000/yii2-backstretch-widget "*"
或者将以下内容添加到您的composer.json
文件的require部分:
"raoul2000/yii2-backstretch-widget": "*"
使用方法
安装扩展后,您可以在代码中像以下示例一样使用它。
在元素#elementId的背景上启动幻灯片.
注意,图片被定义为本地或远程。pluginOptions的第二个参数包含插件的初始化设置,可以重新定义,如果不希望使用默认设置。
raoul2000\widget\backstretch\Backstretch::widget([ 'selector' => '#elementId', 'pluginOptions' => [ [ 'path/to/image1.jpg', 'http://hostname1/path/to/image2.jpg', 'http://hostname2/path/to/image3.jpg' ], [ 'duration' => 3000, 'fade' => 'slow', 'centeredX' => true, 'centeredY' => true ] ] ]);
将Backstretch附加为body的背景
在其最简单的形式中,将图片附加到body元素的背景。默认设置用于初始化插件。
raoul2000\widget\backstretch\Backstretch::widget([ 'pluginOptions' => 'path/to/image1.jpg' ]);
有关完整文档,请参阅jquery-backstretch Github页面
如果此插件没有说服您,请查看背景切换插件
许可证
yii2-backstretch-widget是根据BSD 3-Clause许可证发布的。有关详细信息,请参阅附带LICENSE.md
文件。