I'm trying to find an example of multiple linked sliders similar to es开发者_如何学Ctately's mortgage calculator (can be found on the right bottom of that page).
I've found this example but the sliders aren't linked. Does anyone have a good example i can use?
I think you don't need a tutorial :D It's pretty easy.
Everytime a slider get moved, you update the other sliders.
Use the slide
or change
event and update the other sliders.
For example:
$( "#slider1" ).bind( "slide", function(event, ui) {
$("#slider2").slider({ value: 45 });
$("#slider3").slider({ value: 30 });
});
Just add a slide event for each slider and there you go
I think you're looking to bind to one slider's "slide" event, then using whatever variables you need to calculate and set the value of your associated one(s)
edit
here's a working example: http://www.jsfiddle.net/sNfBM/
using a rudimentary:
// make another slide change
$('#master').bind('slide',function(){
var pct = $('#master').slider('option', 'value') / $('#master').slider('option', 'max');
$('#eq > span').each(function(i,e){
var ppct = parseInt($(this).slider('option','max') * pct);
$(this).slider('option', 'value', ppct);
});
});
精彩评论