JSFiddle - React, Tailwind, and code Playground
by Znarkus
HTML
<p>Restricted to y-axis, but drag position is not</p>
<div style="background:red;width:100px;height:100px;"></div>
<pre style="position:absolute;left:150px;top:30px;"></pre>
JavaScript
$('div').draggable({
axis: 'y',
drag: function (e, p) {
$('pre').html('x: ' + p.position.left + '\ny: ' + p.position.top);
}
});