I have a custom field and i want to filter the view by this custom field with min and max values.
But i want that the filter input as range slider like this
hidden link
In this slider min and max values fixed like 10-100 and when i change the slider view will be changed
I mean if set the range in slider from 11 to 30 then show the data which values is between the 11 to 30 in custom field.
I tried with below code but nothing is happen. I also checked the error in console but no error is there
Filter code :-
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<div id="num-slider"></div>
[wpv-control-postmeta field="wpcf-num" type="textfield" url_param="wpv-wpcf-num_min"]
[wpv-control-postmeta field="wpcf-num" type="textfield" url_param="wpv-wpcf-num_max"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]
Scripts and styles added:-
wp_enqueue_style( 'slider', get_stylesheet_directory_uri() . '/js/jquery-ui.css', array(), '1.1', 'all');
wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/js/jquery-ui.js', array ( 'jquery' ), 1.1, true);
wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/js/jquery.js', array ( 'jquery' ), 1.1, true);
Custom script added in as footer script in theme setting:-
jQuery(document).ready(function(){
jQuery("#num-slider").slider({
range: true,
min: 0,
max: 1000000,
step: 10000,
values: [0, 1000000],
slide: function(event, ui) {
jQuery('#wpv_control_textfield_wpv-wpcf-num_min').val(formatNumber(ui.values[0]));
jQuery('#wpv_control_textfield_wpv-wpcf-num_max').val(formatNumber(ui.values[1]));
}});
jQuery('#wpv_control_textfield_wpv-wpcf-num_min, #wpv_control_textfield_wpv-wpcf-num_max').change(function() {
jQuery('#num-slider').slider('values', [parseInt($('#wpv_control_textfield_wpv-wpcf-num_min').val()), parseInt($('#wpv_control_textfield_wpv-wpcf-num_max').val())]);
});
});
Please help me to get a range slider to filter the view.