0

I am using JQueryUI slider which works great.

I use the slider to perform a function when the slider stops, BUT, I'd like the slider value to update a div as its sliding... so effectively I need to use slider: function(event, ui) { update DIV } and .stop: function(event, ui) { Do Something }. Is this possible? The slider still works but the number the slider is at does not show in the DIV as it should.

Here's what I tried and what failed:

<div id="sliderr" style="width:400px; margin-top:100px;"></div><div id="amount"></div>

$("#sliderr").slider({                   
            value: 0,
            min: -20,
            max: 20,
            step: 0.1,
            slider: function(event, ui) {
                    var curVal = ui.value;
                    $('#amount').text(curVal); 
            },
            stop: function(event, ui) {
                    var curVal = ui.value;
                    this.doSomething(curVal);

            }
    });
4

1 回答 1

3

事件slide不是sliderhttp://api.jqueryui.com/slider/#event-slide

slide: function (event, ui) {
    var curVal = ui.value;
    $('#amount').text(curVal);
},

jsFiddle 示例

于 2013-06-03T16:02:43.123 回答