1
I am using this library to create bars that the user can interact with: http://skidding.github.io/dragdealer.
I would like the drag bar to start at 0, that is, in the middle of the bar:
HTML:
<div id="just-a-slider4" class="dragdealer">
<div style="text-align:center" class="handle red-bar">
<span class="value"></span>%
</div>
</div>
CSS:
#just-a-slider {
height: 60px;
width: 100%;
border-radius: 3px;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
align-content: center;
}
#just-a-slider .handle {
height: 60px;
line-height: 60px;
border-radius: 3px;
background-color:#2c3e50;
}
Javascript:
$(function() {
new Dragdealer('just-a-slider', {
animationCallback: function(x, y) {
$('#just-a-slider .value').text(Math.round(x = 100-x*200));
if (x <0 ) {
$('#just-a-slider .value').text(Math.round(x = -x));;
}
}
});
})
It worked perfectly. Thank you very much.
– Felipe