Take into account the following.
$(function() {
function determineValue() {
var position = $(".ladder").position().top;
var result = 1;
var stepHeight = $(".step").height();
switch (true) {
case (position > 18 && position < 60):
result = 10;
break;
case (position > -22 && position < 17):
result = 9;
break;
case (position > -55 && position < -21):
result = 8;
break;
case (position > -92 && position < -54):
result = 7;
break;
case (position > -130 && position < -92):
result = 6;
break;
case (position > -166 && position < -130):
result = 5;
break;
case (position > -200 && position < -166):
result = 4;
break;
case (position > -238 && position < -200):
result = 3;
break;
case (position > -272 && position < -238):
result = 2;
break;
case (position < -272):
result = 1;
break;
}
return result;
}
$(".ladder").draggable({
axis: "y",
containment: [0, -300, 150, 60],
drag: function(e, ui) {
$(".value").val(determineValue());
}
});
});
.ui-ladder {
width: 150px;
height: 100px;
text-align: center;
overflow: hidden;
position: relative;
}
.ui-ladder .step {
padding: 0.5em 0;
border-bottom: 1px solid #ccc;
}
.ui-ladder .marker {
border-top: 2px solid rgba(255,0,0,0.65);
position: absolute;
top: 51px;
width: 100%;
}
.ui-ladder .value {
position: absolute;
top: 41px;
left: 118px;
width: 1.5em;
padding-left: 5px;
}
.ui-ladder .arrow {
position: absolute;
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 10px solid #ccc;
margin-left: -10px;
top: 42px;
left: 118px;
}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div class="ui-ladder ui-widget">
<div class="ui-widget-content ladder" style="top: -145px">
<div class="step">10</div>
<div class="step">9</div>
<div class="step">8</div>
<div class="step">7</div>
<div class="step">6</div>
<div class="step">5</div>
<div class="step">4</div>
<div class="step">3</div>
<div class="step">2</div>
<div class="step">1</div>
</div>
<div class="marker"></div>
<div class="arrow"></div>
<input class="value ui-widget-header" value="5" type="text" />
</div>