maloja / pico-twentytwenty
此插件为 Pico CMS 添加了 TwentyTwenty 图片对比滑块
Requires
- php: >=5.3.6
- components/jquery: >=3.4
This package is auto-updated.
Last update: 2024-09-14 14:50:29 UTC
README
此插件在 Pico CMS 中添加了 Twentytwenty 图片对比滑块。更多阅读,请参阅 https://github.com/zurb/twentytwenty
屏幕截图
安装
将来自 Github https://github.com/maloja/pico-twentytwenty 的文件复制到您的 Pico CMS 插件文件夹 plugins/PicoTwentyTwenty
或者直接在 plugins/PicoTwentyTwenty
中从 Github 克隆
cd plugins
git clone https://github.com/maloja/pico-twentytwenty
或者,如果您使用 composer 安装了 Pico CMS
composer require maloja/pico-twentytwenty
通过 composer 安装的安装将自动安装 jQuery(见下文)。
权限
默认情况下,您的 Pico CMS 安装不会允许访问 vendor
或 plugins
文件夹中的 JavaScript 文件。请确保您通过修改 Pico CMS 的 .htaccess
文件来授予对这些文件的访问权限
# Permit direct access to jquery scripts
RewriteRule ^vendor/components/jquery.*\.(js)$ - [L,NC]
使用方法
在您的 Markdown 文件中添加以下表达式
(% imgcompare ( /path/to/image1.jpg, /path/to/image2.jpg ) %)
依赖项
此插件需要 jQuery 正确运行。如果通过 composer 安装了 PicoTwentytwenty,那么 jQuery 将会自动安装。否则,jQuery 也可以手动安装,通常存储在 /yourdomain/vendor/components/jquery
下。默认情况下,Pico CMS 不允许访问 jquery.js。必须对 Pico 的 .htaccess
文件进行适配。
RewriteRule ^vendor/components/jquery.*\.(js)$ - [L,NC]
然后可以将 jQuery 集成到 Twig 模板中。
<script src="vendor/components/jquery/jquery.min.js"></script>