egorkhmelev / jslider

jQuery Slider plugin (THIS PROJECT IS NOT MAINTAINED ANYMORE, READ BELOW FOR MORE INFO)
http://egorkhmelev.github.com/jslider
MIT License
507 stars 203 forks source link

Work with zepto? #54

Open mooreds opened 11 years ago

mooreds commented 11 years ago

Thanks so much for the great plugin.

I was wondering if you'd considered making it work with zepto, since this plugin is aimed, at least partially, at mobile devices, and zepto is a nice lightweight jquery alternative.

I tried to make this work with zepto and had issues getting the 'value' attribute of the parameter. Switching to jquery 1.8.3 worked just fine.

Error messages:

Firefox: Error: TypeError: value is undefined Source File: http://localhost:8080/qunittest/src/main/www/js/lib/jquery.slider.js Line: 626

Chrome: Uncaught TypeError: Cannot call method 'toString' of undefined

saurabh-singhi commented 10 years ago

I was able to make it work with Zepto.js. Instead of getting the value like this - $("#Slider1").slider().settings.value, get it like this: slider1[0].value E.g.: // Initialization slider1 = $("#Slider1").slider({ from: 4, to: 20, scale: ['4','8', '12', '16', '20'],
limits: false, step: 1,
});

//Alerting slider value alert('Slider value = '+slider1[0].value);