noUiSlider.create(slider, { start: [<?php echo set_min_price(); ?> , <?php echo set_max_price(); ?> ], connect: true, range: { 'min': <?php echo get_max_or_min_price_by_current_cat(MIN_PRICE_FROM_CATS); ?> , 'max': <?php echo get_max_or_min_price_by_current_cat(MAX_PRICE_FROM_CATS); ?> } }); var valueInput = document.getElementById('value-min'), valueMax = document.getElementById('value-max'); // When the slider value changes, update the input and span slider.noUiSlider.on('update', function( values, handle ) { if ( handle ) { valueMax.value = values[handle]; } else { valueInput.value = values[handle]; } });
function set_max_price() { if (array_key_exists('max', $_GET)) { return intval($_GET['max']); } else { return get_max_or_min_price_by_current_cat(MAX_PRICE_FROM_CATS); } }