There are 2 separate problems here, so let's address each.
First up the JavaScript, the problem is the scope of radios
. Since it's shared between all sliders, it's always set to the last reference you set it to, which is why you only see the third slider having a value - every slider change is setting the last slider's checkboxes. We can fix that by referencing what we want to change relatively, like this:
slide: function(event, ui) {
$(this).closest('.question').find('[data-value=' + ui.value + ']').click();
}
The style issue is a bit more complicated, it's the combination of width and margin messing up the slider's calculations - you'd need tweaks all around but removing margin and aligning the width 90% up a level is the biggest impact. You need to:
- Add
width: 90% margin: 0 5%;
up on.round
- Remove that
margin: 0 0 0 2em;
on.ui-slider-horizontal
- Remove the border on
.ui-slider-horizontal
to make it look correct - add the border up on the.round
level if you still want one
They would now look like this:
ol .round {
background-color: #e6e6e6;
border-radius: 16px;
margin: 0 0 0.5em;
width: 90%;
margin: 0 5%;
}
.ui-slider-horizontal {
background: transparent;
border-radius: 1em;
border: none;
height: 2em;
width: 90%;
}
I also made other tweaks to the slider handle itself in the fiddle to make it fit a bit better (I think).
You can test the changes together here: http://jsfiddle.net/xs3GL/29/