I've made a slider with query/slider and styled it with css. ( http://jsfiddle.net/9qwmX/ )
I succeeded to put the selected value into a div container; but now I want the container to 'travel' with the slider accordingly.
I've tried to use the ui.handle
and its css left
property which is a percentage. But the behavior is somewhat strange: sometimes it travels with the left side of the slider and sometimes with an offset of 10px.
Question: does anybody know a good way to let the box containing the slided-value travel with the handle?
You can do something like this to build what you want, I am using
event.pageX
Demo: http://jsfiddle.net/joycse06/Cw6u8/1/
This is how i would have done it. To get you started:
Make use of the "handle" position:
Position your slide value box with absolute positioning:
And do something with it in the
slide
event:You can just attach a tooltip-like div that you can append to the handle so it moves along with it. You just have to position it with CSS, like so:
JS
CSS tooltip borrowed from the twitter bootstrap framework
Demo: http://jsfiddle.net/9qwmX/2/