Browse Source

Added data-value for labels so they can be put at any value.

pull/4212/head
Gareth Daunton 8 years ago
parent
commit
2a48257b12
1 changed files with 11 additions and 2 deletions
  1. 13
      src/definitions/modules/range.js

13
src/definitions/modules/range.js

@ -155,8 +155,16 @@ $.fn.range = function(parameters) {
position
;
$children.each(function(index) {
ratio = ((index+1)/(numChildren+1));
position = module.determine.positionFromRatio(ratio);
var
$child = $(this),
attrValue = $child.attr('data-value')
;
if(attrValue) {
position = module.determine.positionFromValue(attrValue)
} else {
ratio = ((index+1)/(numChildren+1));
position = module.determine.positionFromRatio(ratio);
}
var posDir =
module.is.vertical()
?
@ -542,6 +550,7 @@ $.fn.range = function(parameters) {
var
min = module.get.min(),
max = module.get.max(),
value = value > max ? max : value < min ? min : value,
trackLength = module.get.trackLength(),
ratio = (value - min) / (max - min),
position = Math.round(ratio * trackLength)

Loading…
Cancel
Save