Clash of 2 JQuery functionalities!
Hello;
I use 2 Javascript filters to filter the results based on hotel star rating and the price in this page.
The checkboxes filters hotels with minimum star rating.
The slider on the other hand filter the results based on the price.
The both work fine but the problem is when I use the slider it messes with the checkbox and checkboxes dont show correct results anymore!
Can anyone help?
I am pretty sure I have to change something in the slider function.
- //Slider Price
- function showProducts(minPrice, maxPrice) {
- $("#products li").hide().filter(function() {
- var price = parseInt($(this).data("price"), 10);
- return price >= minPrice && price <= maxPrice;
- }).show();
- }
- $(function() {
- var options = {
- range: true,
- min: 0,
- max: <?php echo $maximum_number;?>,
- values: [0, <?php echo $maximum_number;?>],
- slide: function(event, ui) {
- var min = ui.values[0],
- max = ui.values[1];
- $("#amount").val("$" + min + " - $" + max);
- showProducts(min, max);
- }
- }, min, max;
- $("#slider-range").slider(options);
- min = $("#slider-range").slider("values", 0);
- max = $("#slider-range").slider("values", 1);
- $("#amount").val("$" + min + " - $" + max);
- showProducts(min, max);
- });
Thank you