A couple of days now, I try to add some range sliders dynamically to a framework 7 page. I found out that I have to use the Range API. I tried to circumvent using it, by copy-pasting the html code of a static range slider. While this mimics the range slider, this ‘fake’ range slider cannot be slided.
Could someone give me a hint how to use the Range API to render range sliders?
Thank you pvtallulah for your help! It is really appreciated.
When I run the jsfiddle however, I only see the slider container, but the slider itself (the knob and line) is not being rendered. Is this an error or caused by my browser (Safari/Chrome)?
i am also trying to generate dynamic range sliders while initially loading the page.
i tested your example but if i press “create range” a second or third time (and so on) the slider does not get rendered properly… there is no knob and line except for the first one which was created.
The example its just an example you have to change the code. The question was how to add a dynamic range. Not multiple. If you cannot manage to do it maybe I can adapt the example to add multiple ranges
Sorry for the delayed response, but finally ready to implement this.
I succeed in reproducing your coding using the ‘methods’ variable. However, I would like to put the code in a seperate js function, because the app needs the capacity to render the slider on different pages based on the admin settings (it is a survey app). How to achieve this?
To take the jsfiddle as starting point, the issue is on line 59; where the range slider is activated which now provides an error. What do I need to put before .range.create({el: ‘.d-range’}) ?
it seems not to work but i think this is because of my little knowledge of framework7 and developing on javascript …
as documented on this page https://framework7.io/docs/page.html#page-events
$$(document).on(‘page:init’, function (e) {
console.log("…Works… --> page:init")
})
works and outputs my string to the console…
trying the same with ‘page:beforein’ does not write any output to the console…
therefore the slider workaround can’t be tested by me what am i doing wrong?
It does still not work …
i think something is wrong with my current implementation, i will start from scratch using @pvtallulah his jsfiddle example and try to get it running there