Skip to content
Open
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
28 changes: 25 additions & 3 deletions angular.rangeSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,17 @@
*/

var $slider = angular.element(element),
uiDefaults = {
pos: 'left',
posOpp: 'right',
orientation: 0
},
handles = [element.find('.ngrs-handle-min'), element.find('.ngrs-handle-max')],
values = [element.find('.ngrs-value-min'), element.find('.ngrs-value-max')],
join = element.find('.ngrs-join'),
pos = 'left',
posOpp = 'right',
orientation = 0,
pos = uiDefaults.pos,
posOpp = uiDefaults.posOpp,
orientation = uiDefaults.orientation,
allowedRange = [0, 0],
range = 0,
down = false;
Expand Down Expand Up @@ -209,6 +214,9 @@

useClass = classNames.join(' ');

// remove classes before adding to ensure that there are no left-overs, so changing the orientation on the fly will work.
$slider.removeClass('ngrs-horizontal ngrs-vertical ngrs-left ngrs-right');

// add class to element
$slider.addClass(useClass);

Expand All @@ -217,7 +225,14 @@
pos = 'top';
posOpp = 'bottom';
orientation = 1;
} else { // back to defaults
pos = uiDefaults.pos;
posOpp = uiDefaults.posOpp;
orientation = uiDefaults.orientation;
}

setMinMax();
setPinHandle( scopeOptions.pinHandle );
});

attrs.$observe('step', function(val) {
Expand Down Expand Up @@ -393,6 +408,13 @@
scope.filteredModelMax = scope.modelMax;
}

// Reset CSS before applying, so changing the orientation on the fly will work.
angular.element( handles[0] ).css( 'top', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'right', '' );
angular.element( handles[1] ).css( 'top', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'right', '' );
angular.element( values[0] ).css( 'top', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'right', '' );
angular.element( values[1] ).css( 'top', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'right', '' );
angular.element( join ).css( 'top', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'right', '' );

// check for no range
if (scope.min === scope.max && scope.modelMin == scope.modelMax) {

Expand Down