Slider with snap


#1

I have a number of sliders on a page that have Id’s derived from a question id loaded from a database. My slider Id’s look like they s-q1-9.1.1 (S = Slider, Q1 = Question Number and 9.1.1 = Question Reference).

I write these slider names (Will also be doing the same for some comments displayed with each question) to an array. The idea is to then loop through the array of Id’s on the page, set or get the values of the sliders and comments boxes and read/write them to a database probably SQLLite and then sync to MySQL.

Each of these sliders need to snap to 20% steps but obviously from your code I do not know the names to be able to handle the observable, any thoughts please. I’m using Javascript.

I have had a look at the native script demo from Plain divider thats snaps to divisions but struggling with the concept for my code.


#2

You don’t even need an id if you use a Repeater containing the Slider and properly bind the values in to it.

The concept of data binding means you don’t have to access your view, just update your data rest is taken care.