Non-linear slider

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8395
    optimus
    optimus
    Participant

    Hi

    I am using the plugin to show properties on my realestate site. i have properties between 200.000 and 20.000.000

    90% of the properties are in between 200.000 and 2.000.000, and i would like the slider to represent this through a non-linear function.

    i have tried to find info, and ive found the instructions to implement this non-linear function in the NOUI slider: https://refreshless.com/nouislider/slider-values/

    However when im looking at jquery.nouislider.all.js (which i assume is the correct file), i cant find the section to edit.

    I would be very happy if you could tell me where to add or change code, in order to implement this function. if you have the time to define 0-90% of slider goes from 200.000-2.000.000 and the last 10% goes from 2.000.000-20.000.000 it would be even more awesome.

    Thanks for what so far looks like a very very good plugin 🙂

    #8396
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Luckily it seems that this is possible with some minor modifications, but to on a different file. Based on the slider documentation and your description it appears that 2 additional parameters are required, and it should work. I’m assuming you want to use a range slider, I guess that’s the best option for this purpose.

    Open up the \ajax-search-pro\includes\views\asp.shortcode.custom_fields.php file on your server and navigate to lines 196-203, where you should see this:

    "main": {
        "start": [ <?php echo $_s_value_low; ?>, <?php echo $_s_value_up; ?> ],
        "step": <?php echo $item->asp_f_range_step; ?>,
        "range": {
            "min": [  <?php echo $item->asp_f_range_from; ?> ],
            "max": [  <?php echo $item->asp_f_range_to; ?> ]
        }
    },

    Based on the documentation and your description, change that code to:

    "main": {
        "start": [ <?php echo $_s_value_low; ?>, <?php echo $_s_value_up; ?> ],
        "step": <?php echo $item->asp_f_range_step; ?>,
        "range": {
            "min": [  <?php echo $item->asp_f_range_from; ?> ],
            "90%": [  2000000, 2000000 ],
            "max": [  <?php echo $item->asp_f_range_to; ?> ]
        }
    },

    If I understand correctly, then this should set the 90% mark to 2 million and increase the stepping to 2 million from the initial from there. That should be an even stepping up to 20 million, similarly distributed as the 25k stepping up to 2 million. Altough it’s just a theory, you might need to experiment a little, or add additional parameters as well 🙂
    Let me know how this works.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8397
    optimus
    optimus
    Participant

    Hi Ernest

    Works perfectly ! as my range starts at 200.000 i just had to insert “90%”: [ 2000000 ],

    Thanks for quick help 🙂

    #8414
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You are welcome, I’m glad it works!

    If you like the plugin, feel free to rate it on your codecanyon downloads page, it’s greatly appreciated.

    If will close this topic and mark it as resolved. If you need any more help, feel free to open a new one.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Non-linear slider’ is closed to new replies.