Skip to content

Add pointer colour to slider #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ The default options are:
ticksValuesTooltip: null,
vertical: false,
selectionBarColor: null,
pointerColour: 'blue',
keyboardSupport: true,
scale: 1,
enforceRange: false,
Expand Down Expand Up @@ -226,6 +227,8 @@ $scope.slider = {

**getSelectionBarColor** - _Function(value) or Function(minVal, maxVal) (defaults to null)_: Function that returns the current color of the selection bar. If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated.

**pointerColour** - _String_: To change the default pointer colour, set this to any valid background-color CSS style.

**hideLimitLabels** - _Boolean (defaults to false)_: Set to true to hide min / max labels

**readOnly** - _Boolean (defaults to false)_: Set to true to make the slider read-only.
Expand Down
16 changes: 10 additions & 6 deletions dist/rzslider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! angularjs-slider - v2.4.0 -
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
https://github.com/angular-slider/angularjs-slider -
/*! angularjs-slider - v2.4.0 -
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
https://github.com/angular-slider/angularjs-slider -
2015-12-30 */
/*jslint unparam: true */
/*global angular: false, console: false, define, module */
Expand Down Expand Up @@ -50,6 +50,7 @@
selectionBarColor: null,
keyboardSupport: true,
scale: 1,
pointerColour: 'blue',
enforceRange: false,
onlyBindHandles: false,
onStart: null,
Expand Down Expand Up @@ -149,7 +150,6 @@
* @type {jqLite}
*/
this.sliderElem = sliderElem;

/**
* Slider type
*
Expand Down Expand Up @@ -246,7 +246,6 @@
* @type {boolean}
*/
this.initHasRun = false;

/**
* Internal flag to prevent watchers to be called when the sliders value are modified internally.
* @type {boolean}
Expand Down Expand Up @@ -427,6 +426,11 @@
this.positionProperty = 'bottom';
this.dimensionProperty = 'height';
}
if (this.options.pointerColour) {
this.scope.pointerStyle = {
backgroundColor: this.options.pointerColour
};
}
},

/**
Expand Down Expand Up @@ -1644,7 +1648,7 @@
'use strict';

$templateCache.put('rzSliderTpl.html',
"<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=\"rz-bar rz-selection\" ng-style=barStyle></span></span> <span class=rz-pointer></span> <span class=rz-pointer></span> <span class=\"rz-bubble rz-limit\"></span> <span class=\"rz-bubble rz-limit\"></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul ng-show=showTicks class=rz-ticks><li ng-repeat=\"t in ticks track by $index\" class=tick ng-class=\"{selected: t.selected}\" ng-style=t.style ng-attr-uib-tooltip=\"{{ t.tooltip }}\" ng-attr-tooltip-placement={{t.tooltipPlacement}} ng-attr-tooltip-append-to-body=\"{{ t.tooltip ? true : undefined}}\"><span ng-if=\"t.value != null\" class=tick-value ng-attr-uib-tooltip=\"{{ t.valueTooltip }}\" ng-attr-tooltip-placement={{t.valueTooltipPlacement}}>{{ t.value }}</span></li></ul>"
"<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=\"rz-bar rz-selection\" ng-style=barStyle></span></span> <span class=rz-pointer ng-style=pointerStyle></span> <span class=rz-pointer ng-style=pointerStyle></span> <span class=\"rz-bubble rz-limit\"></span> <span class=\"rz-bubble rz-limit\"></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul ng-show=showTicks class=rz-ticks><li ng-repeat=\"t in ticks track by $index\" class=tick ng-class=\"{selected: t.selected}\" ng-style=t.style ng-attr-uib-tooltip=\"{{ t.tooltip }}\" ng-attr-tooltip-placement={{t.tooltipPlacement}} ng-attr-tooltip-append-to-body=\"{{ t.tooltip ? true : undefined}}\"><span ng-if=\"t.value != null\" class=tick-value ng-attr-uib-tooltip=\"{{ t.valueTooltip }}\" ng-attr-tooltip-placement={{t.valueTooltipPlacement}}>{{ t.value }}</span></li></ul>"
);

}]);
Expand Down
6 changes: 6 additions & 0 deletions src/rzslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
selectionBarColor: null,
keyboardSupport: true,
scale: 1,
pointerColour: 'blue',
enforceRange: false,
onlyBindHandles: false,
onStart: null,
Expand Down Expand Up @@ -431,6 +432,11 @@
this.positionProperty = 'bottom';
this.dimensionProperty = 'height';
}
if (this.options.pointerColour) {
this.scope.pointerStyle = {
backgroundColor: this.options.pointerColour
};
}
},

/**
Expand Down