lewisjenkins/craft-range-slider
Composer 安装命令:
composer require lewisjenkins/craft-range-slider
包简介
An easy-to-use, flexible and responsive range slider for Craft CMS.
README 文档
README
An easy-to-use, flexible and responsive range slider for Craft CMS.
Requirements
This plugin requires Craft 4 or 5.
Installation
You can install the plugin via the Craft Plugin Store.
LJ Range Slider Overview
This plugin adds the following fieldtype:
- LJ Range Slider
Simple start, basic params
Set min value, max value and start point.
min: 100,
max: 1000,
from: 550
Set type to double, specify range, show grid and add a prefix "$".
type: "double",
grid: true,
min: 0,
max: 1000,
from: 200,
to: 800,
prefix: "$"
Set up range and step
Set up range with negative values.
type: "double",
grid: true,
min: -1000,
max: 1000,
from: -500,
to: 500
Force fractional values, using fractional step 0.1.
type: "double",
grid: true,
min: -12.8,
max: 12.8,
from: -3.2,
to: 3.2,
step: 0.1
UI controls
Hide min and max labels
min: 100,
max: 1000,
from: 550,
hide_min_max: true
Hide from and to labels
min: 100,
max: 1000,
from: 550,
hide_min_max: true,
hide_from_to: true
Using array of custom values
When using custom values, FROM and TO should be zero-based index of values array. So in the example below 0=0, 1=10, 2=100, 3=1000, 4=10000 etc.
type: "double",
grid: true,
from: 2,
to: 5,
values: [0, 10, 100, 1000, 10000, 100000, 1000000]
Values array could be anything, even strings.
grid: true,
from: new Date().getMonth(),
values: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]
Same as above, but using Twig logic.
grid: true,
from: {{ now|date('n') - 1 }},
values: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]
Change visual look of numbers (prettify).
Improve readability of big numbers, like 1000000.
grid: true,
min: 1000,
max: 1000000,
from: 100000,
step: 1000,
prettify_enabled: true,
prettify_separator: ","
Decorating numbers with prefixes, postfixes and other symbols.
Adding currency symbol and + symbol to the maximum number.
grid: true,
min: 0,
max: 100,
from: 50,
step: 5,
max_postfix: "+",
prefix: "$"
grid: true,
min: 0,
max: 100,
from: 50,
step: 5,
postfix: " €"
Using prefix and postfix at the same time.
grid: true,
min: 0,
max: 100,
from: 21,
max_postfix: "+",
prefix: "Age: ",
postfix: " years"
Customising Grid
Divide the grid.
grid: true,
min: 0,
max: 100,
from: 20,
grid_num: 4
grid: true,
min: 0,
max: 100,
from: 20,
grid_num: 5
Callbacks
Using sliders callbacks.
min: 0,
max: 5,
from: 3,
prefix: "Warp factor: ",
grid: true,
grid_num: 5,
onStart: function (data) {
// fired when range slider is ready
},
onChange: function (data) {
// fired on every range slider update
if (data.from <= 4) {
console.log("Scotty, we need more power!");
} else {
console.log("Captain, she cannae take anymore!");
}
},
onFinish: function (data) {
// fired on pointer release
}
Twig logic
The Slider Parameters field can use Twig logic and even Craft element queries.
{% set values %}
{% for i in currentUser.friendlyName|split('') %}
"{{ i|upper }}"{{ not loop.last ? ',' }}
{% endfor %}
{% endset %}
type: "double",
grid: true,
grid_num: {{ currentUser.friendlyName|length - 1 }},
values: [ {{ values }} ]
You can even fetch your Slider Parameters from a template.
{% include '_myRangeSliderParams' ignore missing %}
Skins
Big skin
min: 100,
max: 1000,
from: 550,
skin: "big"
Modern skin
min: 100,
max: 1000,
from: 550,
skin: "modern"
Sharp skin
min: 100,
max: 1000,
from: 550,
skin: "sharp"
Round skin
min: 100,
max: 1000,
from: 550,
skin: "round"
Square skin
min: 100,
max: 1000,
from: 550,
skin: "square"
Additional Options
See the original ion.rangeSlider project for additional options.
Templating
"Single" Range Slider fields return a single FROM value.
{{ entry.myRangeSliderField }}
// Prints something like: 550
"Double" Range Slider fields returns FROM and TO values, separated by ; character.
{{ entry.myRangeSliderField }}
// Prints something like: 200;800
{% set myRangeSliderField = entry.myRangeSliderField|split(';') %}
{{ myRangeSliderField[0] }}
// 200
{{ myRangeSliderField[1] }}
// 800
This plugin is based on the ion.rangeSlider plugin [MIT licence], with thanks to the original developer.
Brought to you by Lewis Jenkins.
lewisjenkins/craft-range-slider 适用场景与选型建议
lewisjenkins/craft-range-slider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.74k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「Craft」 「craftcms」 「craft-plugin」 「craft range slider」 「lj range slider」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lewisjenkins/craft-range-slider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lewisjenkins/craft-range-slider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lewisjenkins/craft-range-slider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Expand, collapse, change the status of, or delete multiple blocks in a Matrix field simultaneously.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Integrate with Snipcart.
Restrict user registration by domain in Craft CMS, allows you to limit who can register for your site based on their email address.
统计信息
- 总下载量: 4.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2019-07-21





















