Comparison Slider code is not working.

  • James
    Asked on April 8, 2020 at 11:50 AM

    This is great! But I am getting an error 'Uncaught TypeError: Cannot read property '0' of undefined' when it moves all the way to the left.From line:var startX = (e.pageX) ? e.pageX : e.originalEvent.touches[0].pageX;

  • David JotForm Support Manager
    Replied on April 8, 2020 at 1:26 PM

    Thank you for contacting us. There is a widget already implemented for this purposes, it is called Comparison Slider: https://www.jotform.com/widgets/comparison-slider

    You can add it to your existing form as shown on this guide: https://www.jotform.com/help/252-How-to-Add-a-Widget-to-Your-Form

  • James
    Replied on April 9, 2020 at 4:50 AM

    Hi this really didn't answer or have any relation to my comment.

  • Ivaylo JotForm Support
    Replied on April 9, 2020 at 7:49 AM

    Did you try to use our Comparison Slider widget?

    I would suggest you to please explain your question a bit more in detail and we will try to help you. So, please elaborate.

    Looking forward to your response.

  • James
    Replied on April 9, 2020 at 4:25 PM

    I'm using the code in my own project as suggested here "We hope it will save developers time, and that they will use in their own projects."

    The code supplied throws up a console error, as described in my original post

    You can see the console error on this example provided by you: https://www.jotform.com/adobe-formscentral-alternative/

    It happens when you slide the slider all the way to the left.

    My point was to let you know that it's creating an error, but also ask how it could be fixed?

    I really appreciate the code, and it's the best comparison slider I have seen. 

    Thank you.

  • Kevin Support Team Lead
    Replied on April 9, 2020 at 6:34 PM

    The code may be outdated; however, it's possible that this is not corrected as it's not a feature that JotForm offers, I mean, it's not an element, widget or app developed by JotForm.

    You may also implement a different code/plugin, here is a page where you can find information about something similar: https://www.w3schools.com/howto/howto_js_image_comparison.asp