Skip to content

Commit

Permalink
Additional class for extra customization
Browse files Browse the repository at this point in the history
  • Loading branch information
abpetkov committed Mar 4, 2014
1 parent 146b03a commit 8f04474
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions dist/powerange.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ var defaults = {
, disable: false
, disableOpacity: 0.5
, hideRange: false
, klass: ''
, min: 0
, max: 100
, start: null
Expand Down Expand Up @@ -1083,6 +1084,17 @@ Powerange.prototype.insertAfter = function(reference, target) {
reference.parentNode.insertBefore(target, reference.nextSibling);
};

/**
* Add an additional class for extra customization.
*
* @param {String} klass
* @api private
*/

Powerange.prototype.extraClass = function(klass) {
if (this.options.klass) classes(this.slider).add(klass);
};

/**
* Set min and max values.
*
Expand Down Expand Up @@ -1209,6 +1221,7 @@ Powerange.prototype.changeEvent = function(state) {
Powerange.prototype.init = function() {
this.hide();
this.append();
this.extraClass(this.options.klass);
this.bindEvents();
this.checkValues(this.options.start);
this.setRange(this.options.min, this.options.max);
Expand Down Expand Up @@ -1486,7 +1499,7 @@ require.alias("vesln-super/lib/super.js", "vesln-super/index.js");
require.alias("powerange/lib/powerange.js", "powerange/index.js");if (typeof exports == "object") {
module.exports = require("powerange");
} else if (typeof define == "function" && define.amd) {
define(function(){ return require("powerange"); });
define([], function(){ return require("powerange"); });
} else {
this["Powerange"] = require("powerange");
}})();
}})();
2 changes: 1 addition & 1 deletion dist/powerange.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
var Powerange = require('powerange');

var def = document.querySelector('.js-default');
var initdef = new Powerange(def);
var initdef = new Powerange(def, { klass: 'test' });

var vert = document.querySelector('.js-vert');
var initvert = new Powerange(vert, { vertical: true, step: 10, start: 77 });
Expand Down
12 changes: 12 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ Powerange.prototype.insertAfter = function(reference, target) {
reference.parentNode.insertBefore(target, reference.nextSibling);
};

/**
* Add an additional class for extra customization.
*
* @param {String} klass
* @api private
*/

Powerange.prototype.extraClass = function(klass) {
if (this.options.klass) classes(this.slider).add(klass);
};

/**
* Set min and max values.
*
Expand Down Expand Up @@ -256,6 +267,7 @@ Powerange.prototype.changeEvent = function(state) {
Powerange.prototype.init = function() {
this.hide();
this.append();
this.extraClass(this.options.klass);
this.bindEvents();
this.checkValues(this.options.start);
this.setRange(this.options.min, this.options.max);
Expand Down
1 change: 1 addition & 0 deletions lib/powerange.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var defaults = {
, disable: false
, disableOpacity: 0.5
, hideRange: false
, klass: ''
, min: 0
, max: 100
, start: null
Expand Down

0 comments on commit 8f04474

Please sign in to comment.