问题
I'm looking for a JavaScript control that is a Range Slider (dual knob) that:
- does NOT use an existing JS framework (e.g. dojo, jquery, etc) - unless you can roll/create your own sub framework where I can compile in just the components I need.
- works in all major browsers
An example a Range Slider is below, but of course this uses JQuery - so this is not an option because even if I built JQuery only including the components I need (JQuery UI core + Slider) it's 140kb MINIFIED:
http://jqueryui.com/demos/slider/#range
回答1:
jQuery UI has a nice one:
http://jqueryui.com/demos/slider/
回答2:
YUI 3 (which is currently in preview release) only pulls in the absolute minimum amount of code required to do what you ask. Their basic slider example (http://yuilibrary.com/yui/docs/slider/slider-basic.html) only pulls in 24k of JavaScript and less than 1k of CSS. It's pretty slick.
disclosure: I work for Yahoo!.
回答3:
Use the slider code from http://www.walterzorn.com/dragdrop/dragdrop_e.htm#addons. It's a single handle but the underlying drag-drop.js is very flexible. You just need to add your own second slider and programmatically lock each bars' min-max range based on the position of the other. You're looking at 1 12kb (lgpl'ed) script include and about 10-20 lines of code to implement this.
来源:https://stackoverflow.com/questions/877530/javascript-range-slider-dual-slider-exist-without-using-a-framework