How to get value from jQuery UI slider?

后端 未结 10 2563
粉色の甜心
粉色の甜心 2020-12-01 15:22

I am working on http://gamercity.info/ymusic/. And I am using UI slider as seek bar. While the video is played I want to invoke a seekTo(seconds) function if us

相关标签:
10条回答
  • 2020-12-01 16:18

    I checked all the answers mentioned above, but found none useful as the following code:

    $('#slider').slider("values")[0]; // for slider with single knob or lower value of range
    $('#slider').slider("values")[1]; // for highest value of range
    

    Tested with jQuery v2.1.1 and jQuery-ui v1.12.1

    0 讨论(0)
  • 2020-12-01 16:19
    $('#slider').slider({
        change: function(event, ui) { 
            alert(ui.value); 
        } 
    });​
    

    http://jqueryui.com/demos/slider/

    0 讨论(0)
  • 2020-12-01 16:24
      // Price Slider
            if ($('.price-slider').length > 0) {
                $('.price-slider').slider({
                    min: 0,
                    max: 2000,
                    step: 10,
                    value: [0, 2000],
                    handle: "square",
    
    
                });
            }
    
    
    
    $(document).ready(function(){
    
     $(".price-slider").on( "slide", function( event, ui ) {  console.log("LA RECTM");  var mm = $('.tooltip-inner').text(); console.log(mm);   var divide = mm.split(':');   console.log( "min:" +divide[0] + " max:" + divide[1] )     } );
    
    
    
    
    })
    
    0 讨论(0)
  • 2020-12-01 16:26

    You can pass the value to any function or set any element with the value:

    $(function () {
        $('#slider').slider({
            max: 100,
            slide: function (event, ui) {
                $('#anyDiv').val(ui.value);
            }
        });
    });
    
    0 讨论(0)
提交回复
热议问题