hey,
Christian once helped me out with a jquery slider on this thread:
https://toolset.com/forums/topic/range-slider-of-custom-field/
I got the slider to work but it wasn't good enough, so I tried another jquery script, and now have no idea how to get the min-max values of the custom field to be used within the slider like before.
this is the html:
<link rel="stylesheet" href="<em><u>hidden link</u></em>">
<script src="<em><u>hidden link</u></em>"></script>
<div class="search">
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<h2>[wpml-string context="wpv-views"]Category[/wpml-string]</h2>
[wpv-control-post-taxonomy taxonomy="things-category" type="checkboxes" url_param="wpv-things-category"]
</div>
<h2>[wpml-string context="wpv-views"]Price[/wpml-string]</h2>
<input type="text" id="sampleSlider" />
<div class="form-group pricebox">
[wpv-control-postmeta field="wpcf-thing-price" url_param="wpv-wpcf-thing-price_min" placeholder="Choose Min"]
</div>
<div class="form-group pricebox" style="margin-right: 0 !important;">
[wpv-control-postmeta field="wpcf-thing-price" url_param="wpv-wpcf-thing-price_max" placeholder="Choose Max"]
</div>
[wpv-filter-submit output="bootstrap"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]
This is the JS, but I still didn't do anything with the min-max values:
var mySlider = new rSlider({
target: '#sampleSlider',
values: [100, 200, 300, 400, 500],
range: true,
tooltip: false,
scale: true,
labels: true,
set: [100, 500]
});
The code Christian helped me getting to word on the outdated slider was this:
,
$( function() {
$( "#slider-range" ).slider({
range: true,
min: 100,
max: 500,
step: 100,
values: [ 100, 500 ],
slide: function( event, ui ) {
jQuery('#wpv_control_textfield_wpv-wpcf-thing-price_min').val(formatNumber(ui.values[0]));
jQuery('#wpv_control_textfield_wpv-wpcf-thing-price_max').val(formatNumber(ui.values[1]));
}});
jQuery('#wpv_control_textfield_wpv-wpcf-thing-price_min, #wpv_control_textfield_wpv-wpcf-thing-price_max').change(function() {
jQuery('#slider-range').slider('values', [parseInt($('#wpv_control_textfield_wpv-wpcf-thing-price_min').val()), parseInt($('#wpv_control_textfield_wpv-wpcf-thing-price_max').val())]);
});
});
var formatNumber = function(number)
{
number += "";
var parts = number.split('.');
var integer = parts[0];
var decimal = parts.length > 1 ? '.' + parts[1] : '';
var regex = /(d+)(d{3})/;
while (regex.test(integer))
{
integer = integer.replace(regex, '$1' + ',' + '$2');
}
return integer + decimal;
};
I've tried adding snippets of it to the new JS, but didn't make it.
Any help?
Thanks!
Ido