jQuery UI滑块的最小值/最大值 [英] jquery UI slider min/max values

查看:391
本文介绍了jQuery UI滑块的最小值/最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的问题.我可以为jquery ui滑块以及滚动显示数字时输入文本的最小值/最大值吗? 此处是一个示例,最大值的左滑块没有限制,当您滚动时,出现数字.

HI guys I have one simple question. Can I put text min/max values for jquery ui slider and when scroll to appear digits? Here is an example, the left slider for max value has "no limit" and when you scroll it, appear digits.

推荐答案

您正在寻找范围滑块.希望范围滑块演示对您有所帮助.可以在初始化滑块时设置最小值和最大值.

You are looking for the range slider. I hope the range slider demo helps. The min and max values can be set while initialising the slider.

已编辑 很抱歉误解了这个问题.如果您查看演示的源代码,您会看到一个小的脚本,它会更改值更改滑块值时元素"#amount"的位置

Edited Sorry for misunderstanding the question. If you look at the source code of the demo you will see a small script that changes the values of element '#amount' when slider values are changed

这是脚本:

slide: function( event, ui ) {
            $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
        }

您可以更改它以显示字符值.

You can change this to display character values.

slide: function( event, ui ) {
            if (ui.values[0] == <min_value>) {
                 $( "#amount" ).val( "Min Limit" + " - $" + ui.values[ 1 ] );
            }
        }

您可以根据需要修改此脚本

You can modify this script according to your requirements

注意:我尚未对此进行测试.

Note: I have not tested this.

这篇关于jQuery UI滑块的最小值/最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆