JQuery Slider UI - Enhancements

I tried jQuery Slider and used an example for the game.

EDIT: I would like the slider to show the values ​​as a ruler to increase usability. Like now, it's hard for me to pass usability testing. People complain that they want to know what value they collect before they begin to glide.

Any ideas how I can achieve this? As far as I was looking, I could not find out if this function exists or how to do it.

<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.slider.js"></script>
<style type="text/css">
    #slider { margin: 10px; }
</style>
<script type="text/javascript">
    $(function() {
        $("#slider").slider({           
            value: 50,
            min: 0,
            max: 99,
            step: 1,
            slide: function(event, ui) {
                $("#amount").val('$' + ui.value);
            }
        });
        $("#amount").val('$' + $("#slider").slider("value"));
    });
</script>
</head>
<body style="font-size:62.5%;">
<div id="slider"></div>
<input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
</body>
</html>
+5
source share
3 answers

I found an example of a jQuery UI slider that displays hash markings.

jQuery UI Slider from selected item

. , .

+5

<div id='support_slider' class='slider' alt='" + pct + "'></div>
<input id='support_input' class='input' alt='" + pct + "' value='" + pct + "' size='1'/>

$("#support_slider").slider({
    //animate: true,
    min: 0,
    max: 10,
    value: pct,
    slide: function(event, ui) {
            set_sliders_and_input($(this), $(this).next(), $(this).next().attr("value"), ui.value);
    }
});

$("#support_input").keyup(function(event) {
    set_sliders_and_input($(this).prev(), $(this), $(this).attr("alt"), $(this).attr("value"));
});

function set_sliders_and_input(slider, input, oldv, newv) {
    if ( newv < 0 || newv > 100 ) return false;
    var diff = oldv - newv;
    input.attr("value", newv).attr("alt", newv);
    slider.slider('option', 'value', newv);
    GM_setValue('support_pct', newv);
    return true;
}
0

, . !:

http://www.keepthewebweird.com/creating-a-nice-slider-with-jquery-ui/

Follow the tutorial! for some reason, the demonstration spoiled a bit.

0
source

All Articles