Here is a simple bit of htm/jquery that you can cut-and-paste into notepad and save and run on your desktop:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#moveup').click(function() {
var opt = $('#sourceSelect option:selected');
if(opt.is(':first-child')) {
opt.insertAfter($('#sourceSelect option:last-child'));
}
else {
opt.insertBefore(opt.prev());
}
});
});
$(document).ready(function() {
$('#movedown').click(function() {
var opt = $('#sourceSelect option:selected');
if(opt.is(':last-child')) {
opt.insertBefore($('#sourceSelect option:first-child'));
}
else {
opt.insertAfter(opt.next());
}
});
});
</script>
</head>
<body>
<select name="sourceSelect" id="sourceSelect" size="4">
<option value="example1">Example1</option>
<option value="example2">Example2</option>
<option value="example3">Example3</option>
<option value="example4">Example4</option>
<option value="example5">Example5</option>
<option value="example6">Example6</option>
<option value="example7">Example7</option>
<option value="example8">Example8</option>
<option value="example9">Example9</option>
</select>
<input type="button" name="moveup" id="moveup" value="up" />
<input type="button" name="movedown" id="movedown" value="down" />
</body>
</html>
Select an item, click the move up or move down button and that item will ... well, move up or down!
The problem is that in IE or Edge, once you reach the bottom or top of the container, it "moves" out of sight. The container doesn't scroll.
Chrome, Firefox, Opera - all work fine.
I've tried multiple ways (in JQuery) to move up/down. I've tried scrollIntoView and scrollTop's. I need some way to keep the item visible.
Has anyone ran into this issue?