I'm using this library to create bars that the user can interact with: link .
I would like the drag bar to start at 0, in the middle of the bar:
However,Ihaveitasfollows:
HTML:
<divid="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));;
}
}
});
})