我正在为选择器使用jquery滑块,您可以在其中设置价格的最小值和最大值。
我的问题是它可以将max和min选择器设置为相同的值。
有没有办法防止这种情况发生?
我已经阅读了插件的所有可选选项 - 参数,似乎没有办法在不编辑插件的情况下解决这个问题?
感谢您的帮助
修改
此处为https://jqueryui.com/slider/#range
所示的标准滑块
$( function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 500,
values: [ 75, 300 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
} );
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Slider - Range slider</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<p>
<label for="amount">Price range:</label>
<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-range"></div>
</body>
</html>
答案 0 :(得分:1)
解决方案是将以下代码添加到public static void main(String[] args) throws Exception {
SparkConf sparkConf = new SparkConf().setAppName("HBaseRead").setMaster("local[*]");
JavaSparkContext jsc = new JavaSparkContext(sparkConf);
Configuration hbaseConf = HBaseConfiguration.create();
hbaseConf.set(TableInputFormat.INPUT_TABLE, "my_table");
JavaPairRDD<ImmutableBytesWritable, Result> javaPairRdd = jsc.newAPIHadoopRDD(hbaseConf, TableInputFormat.class,ImmutableBytesWritable.class, Result.class);
jsc.stop();
}
}
slide:
您还可以在以下代码段中对其进行测试
if(ui.values[ 0 ] +19 >= ui.values[ 1 ]){
return false;
}
&#13;
$( function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 500,
values: [ 75, 300 ],
slide: function( event, ui ) {
if(ui.values[ 0 ] +19 >= ui.values[ 1 ]){
return false;
}
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
} );
&#13;