[英]Jquery slider UI issue
Im having trouble with the min and max values of the jQuery Slider UI. 我在使用jQuery Slider UI的最小值和最大值时遇到麻烦。 I set the min value to 5000 and the max value to 1000000 with 25000 step increments. 我将最小值设置为5000,将最大值设置为1000000,并以25000的步长递增。 However when I view it on the front-end I get the following: 但是,当我在前端查看它时,会得到以下信息:
Here is my code: 这是我的代码:
$( "#slider-range" ).slider({
range: true,
step:25000,
min: 5000,
max: 1000000,
values: [ 5000, 1000000 ],
slide: function( event, ui ) {
$( "#657401867-MinPrice" ).val( (ui.values[ 0 ] + "").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") );
//$( "#MinPrice" ).text( ui.values[ 0 ] );
$( "#657401867-MaxPrice" ).val( (ui.values[ 1 ] + "").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") );
//$( "#MaxPrice" ).text( ui.values[ 1 ] ); ($( "#slider-range" ).slider( "values", 0 ) + "").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
}
});
So for some reason, on the front end it has the max value as 980,000 instead of 1,000,000. 因此,由于某种原因,在前端它的最大值为980,000,而不是1,000,000。
This is probably because the step
value is 25,000
. 这可能是因为step
值是25,000
。 If you increment your min
of 5,000
by 25,000
, the largest possible value is 980,000
, since your max
is 1,000,000
. 如果将5,000
的min
增加25,000
,则最大可能值为980,000
,因为max
为1,000,000
。 I'd recommend changing the step
value to 5,000
to solve this issue. 我建议将step
值更改为5,000
以解决此问题。
Starting from 5,000 (your min
value), in steps of 25,000 ( step
value), the highest step lower than 1,000,000 (your max
) is actually 980,000. 从5,000(您的min
)开始,以25,000(您的step
值)为步长,低于1,000,000(您的max
)的最高步长实际上为980,000。
In order to avoid this you should do on of these options: 为了避免这种情况,您应该对以下选项进行操作:
step
to be 5,000 将step
更改为5,000 min
value to be 0 or 25,000 将min
设置为0或25,000 max
value to 1,005,000 将max
更改为1,005,000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.