0
I am developing a course platform website, each course can take many lessons.
In the database, each class has a column called position
, then for the end user, simply make a listing in order of the position
, then the classes would be displayed in the right order.
The problem is in the administrative panel, after registering all classes, I would like to organize them by dragging them to the position I wish and then saving, sending to the database to position
of each class,
Drag as in this example
https://drive.google.com/file/d/1L__uKtZXrSC3huhoCuZ-AaKlPOCPtC3U/view
on my Dashboard, HTML and CSS is similar to this
.box {
width: 400px;
height: 30px;
line-height: 30px;
background: #232323;
color: #fff;
border-radius: 5px;
margin: 1rem 0px;
padding: 0.5rem;
}
<div class="box" position="1">position 1 - learn HTML</div>
<div class="box" position="2">position 2 - learn CSS</div>
<div class="box" position="3">position 3- learn JavaScripte</div>
So how do I drag the Divs/lessons, always keeping the atributo position
with the correct value of the position the div is in?