Rangeinput(Jquery Flow Tools)1 个范围内有 2 个句柄,可能吗?

发布于 2024-09-10 10:31:11 字数 219 浏览 1 评论 0原文

根据此插件 http://flowplayer.org/tools/demos/rangeinput/index.html html

有人知道如何向范围添加第二个句柄吗?我在官方网站上问过这个问题,但仍然没有答案:(

As per this plugin http://flowplayer.org/tools/demos/rangeinput/index.html

Does anybody know how to add second handle to the range? I've asked this on official site but still no answer :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天的雪花 2024-09-17 10:31:11

我所做的就是创建两个范围,然后将它们移到另一个的顶部,再加上一些代码来防止最小值超过最大值:

var myform_from = $("#myform").find(".slider:first");
var myform_to = $("#myform").find(".slider:last");

myform_from.css("top", 16);
myform_to.css("top", -16);

这与 jQuery 工具网站的第一个示例配合良好,并且您将获得两个句柄。

防止左侧超越右侧的事件处理程序:

myform_from.change(function(){
    var val = myform_from.data("rangeinput").getValue();
    if(val >= myform_to.data("rangeinput").getValue()){
        myform_to.data("rangeinput").setValue(val);
    }
});

myform_to.change(function(){
    var val = myform_to.data("rangeinput").getValue();
    if(val <= myform_from.data("rangeinput").getValue()){
        myform_from.data("rangeinput").setValue(val);
    }
});

这样我就不会破坏 HTML5 语义,并且可以获得两个句柄。

What I do is make two ranges then move them one on top of the other, plus some code to prevent the minimum to go over the maximum:

var myform_from = $("#myform").find(".slider:first");
var myform_to = $("#myform").find(".slider:last");

myform_from.css("top", 16);
myform_to.css("top", -16);

This works fine with the first example from the jQuery tools website, and you get two handles.

The event handler to pervent the left from overtaking the right:

myform_from.change(function(){
    var val = myform_from.data("rangeinput").getValue();
    if(val >= myform_to.data("rangeinput").getValue()){
        myform_to.data("rangeinput").setValue(val);
    }
});

myform_to.change(function(){
    var val = myform_to.data("rangeinput").getValue();
    if(val <= myform_from.data("rangeinput").getValue()){
        myform_from.data("rangeinput").setValue(val);
    }
});

This way I don't break the HTML5 semantics and I get two handles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文