To set the starting values of the slider to 5000 and 15000, you can change the 'values' option of the slider to '[5000, 15000]' in the $(function() {}) function:

var min = 0;
var max = 10000000;
var startMin = 5000;
var startMax = 15000;

$(function() {
    $( '#slider-range' ).slider({
      range: true,
      min: min,
      max: max,
      step: 50000,
      values: [startMin, startMax],
      slide: function( event, ui ) {
        $( '#amount' ).html( '$' + ui.values[ 0 ] + ' - $' + ui.values[ 1 ] );
        $( '#min' ).val(ui.values[ 0 ]);
        $( '#max' ).val(ui.values[ 1 ]);
        $(ui.handle).attr('data-value', ui.value); // Update handle popup value

        $('#qp_has_price').attr('data_value', ui.values[ 0 ]+'to'+ui.values[ 1 ]);
        $('.qq_price_range .qq_selected_terms').html( ui.values[ 0 ]+','+ui.values[ 1 ]);
      
        $('.qq_clear_all_filters').prop('disabled', false);

        setQueryStringParameter('price', ui.values[ 0 ]+'to'+ui.values[ 1 ]);
        qq_call_loads();
      }
    });
    
    $( '#amount' ).html( '$' + $( '#slider-range' ).slider( 'values', 0 ) +
     ' - $' + $( '#slider-range' ).slider( 'values', 1 ) );
     
    // Initialize handle popups with default values
    $('#slider-range .ui-slider-handle:first').attr('data-value', startMin);
    $('#slider-range .ui-slider-handle:last').attr('data-value', startMax);
});

By setting startMin to 5000 and startMax to 15000, the slider will start with those values.

jQuery UI Slider: How to Set Starting Values

原文地址: https://www.cveoy.top/t/topic/qf8N 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录