0
我有2個滑塊,Slider1和slider2。我正在嘗試根據slider1的值動態更改slider2的最大值。所以如果slider1的值是100,slider2的最大值將是100.我無法弄清楚如何實現這一點。我在網上看過幾個指南,但由於某些原因,他們不工作。更新初始滑塊的jQuery滑塊最大值
$(function() {
$("#slider1").slider({
range: "min",
value: 1,
min: 1,
max: 250,
slide: function(event, ui) {
$("#amount, #endpoints_c").val("" + ui.value);
if($("#slider1").slider("value") >= "15"){
$("#sliderb").fadeIn("fast")
}
if($("#slider1").slider("value") <= "14"){
$("#sliderb").fadeOut("fast")
}
}
});
$("#amount").val("" + $("#slider1").slider("value"));
$("#slider2").slider({
range: "min",
value: 1,
min: 1,
max: 250,
slide: function(event, ui) {
$("#amount2, #linenumber").val("" + ui.value);
}
});
$("#amount2").val("" + $("#slider2").slider("value"));
$("#gonext ").click(function(){
$("#optionset1 ").fadeOut("fast");
$("#optionset2 ").fadeIn("fast");
});
$("#goprev ").click(function(){
$("#optionset2 ").fadeOut("fast");
$("#optionset1 ").fadeIn("fast");
});
});
下面是HTML:
<div id="options-container">
<div id="optionset1">
<div id="slidera" class="slider">
<h1>Slider1</h1>
<div id="slider1" class="bar"></div>
<input type="text" class="amount" id="amount" disabled />
</div>
<br clear="all" />
<div id="sliderb" class="slider" style="display:none;">
<h1>Slider2</h1>
<div id="slider2" class="bar"></div>
<input type="text" class="amount" id="amount2" disabled />
</div>
<br clear="all" />
<button value="next" id="gonext">Next</button>
</div>
<div id="optionset2" class="slider">
<p><link rel="stylesheet" type="text/css" media="all" href="?s=d8fbeb2c5a04ce&c=1" href="?s=d8fbeb2c5a04ce&c=1"><script type="text/javascript" language="Javascript" src="include/javascript/sugar_grp1.js?s=d8fbeb2c5a04ce&c=1" src="include/javascript/sugar_grp1.js?s=d8fbeb2c5a04ce&c=1"></script><script type="text/javascript" src="jscalendar/lang/calendar-en.js?s=d8fbeb2c5a04ce&c=1" src="jscalendar/lang/calendar-en.js?s=d8fbeb2c5a04ce&c=1"></script></p>
<style>
.rcstyles input{width:130px;}
</style>
哪裏HTML? – 2012-07-10 00:39:21
我已經添加了HTML – ipengineer 2012-07-10 00:52:23