简体   繁体   中英

jQuery ui range slider gives wrong value

I use jQuery UI range slider for IE 9 and lower. With it I want to update the font size live.
My problem is that the range slider does not slide correctly. I cant get value 0 after 1. I also cant gate vaule 100 after 99.

function update() {
        var Rvalue = $('#range-slider').slider('value');
        $("#slidevalue").text(Rvalue);
    };
    $(function() {
        $( "#range-slider" ).slider({
            range:false,
            min: 0,
            max: 100,
            value: 20,
            slide: function( event, ui ) {
                update();
            }
        });
    });


Here is a jsFiddle

Your problem is your update function.
Try like this :

$(function() {
    $( "#range-slider" ).slider({
        min: 0,
        max: 100,
        value: 20,
        slide: function( event, ui ) {
            $( "#slidevalue" ).text( ui.value );
        }
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM