I'm using the jQuery UI Slider plugin to make sliders for my page, but I want to add different labels to each of the slider handles. The code for the sliders is a simple div:
<div class="slider"></div>
This is transformed into a slider through the CSS:
.ui-slider { position: relative; text-align: left; margin: 1.5em auto 1.5em auto; width:10% }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.5em; height: 1.5em; cursor: default; }
.ui-slider .ui-slider-range { text-align:center; position: absolute; z-index: 1; font-size: .7em; display: block; border: 10; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.77em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
Then, the classes are added through scripting. I tried just putting the text between the div tags, but that didn't work:
<div class="slider">Testing</div>
How can I get the text on top of the slider handle, and allow the text to move with it?
EDIT: I got the text on top of the slider handle, but it won't move when the slider moves.
CSS:
.label {
z-index:999;
position:relative;
}
HTML:
<div class="slider"><div class="label">Testing</div></div>
Result:
EDIT 2: Here's a Fiddle.