/** * Super Slider * Last update: 12 Jan 2011 * * Changelog: * 0.1 - Initial release * * * Copyright (c) 2011 Tom Beddard * http://www.subblue.com * * Released under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ /*global window, $, document*/ function SuperSlider(id, opts) { this.id = id; this.init(opts); return this.slider; } SuperSlider.prototype = { init: function (opts) { var self = this, opt, style; this.options = { slider_class : 'ss_slider', // slider class name track_class : 'ss_track', // track class name handle_class : 'ss_handle', // handle class name input_class : 'ss_input', // input class name label_class : 'ss_label', // label class name min : 0, // minimum value max : 1, // maximum value step : 0.01, // step increment default_value : 0.5, // default value value : 0.5, // current value decimal_places : 3, // decimal place rounding label : null, // label name : null // input name attribute }; for (opt in opts) { if (opts.hasOwnProperty.call(opts, opt)) { this.options[opt] = opts[opt]; } } // Build slider this.slider = $("
") .addClass(this.options.slider_class) .css("webkitUserSelect", 'none'); this.track = $("
").addClass(this.options.track_class); this.handle = $("
").addClass(this.options.handle_class); this.input = $("") .attr("type", "input") .addClass(this.options.input_class) .attr("value", this.options.value); if (this.options.name) { this.input.attr("name", this.options.name); } if (this.options.label) { this.label = $("