Home  >  Article  >  Backend Development  >  Drag and sort pictures, how to save the sorted order?

Drag and sort pictures, how to save the sorted order?

WBOY
WBOYOriginal
2016-08-23 09:17:461905browse

Now I want to save the current order of the pictures after dragging and sorting them. The problem is that when I drag the pictures now, when I click save, it is still in the previous order.
Drag and sort pictures, how to save the sorted order?

Drag and sort pictures, how to save the sorted order?

<code>   //获取图片数组
    var goods_img = new  Array;
    $("._img").each(function(i){
        goods_img[i] = $(this).attr('src');
    });</code>

I change the position of the pictures, but the order of the pictures obtained does not change. Is there any way to drag the pictures so that the order of the pictures obtained also changes?

Reply content:

Now I want to save the current order of the pictures after dragging and sorting them. The problem is that when I drag the pictures now, when I click save, it is still in the previous order.
Drag and sort pictures, how to save the sorted order?

Drag and sort pictures, how to save the sorted order?

<code>   //获取图片数组
    var goods_img = new  Array;
    $("._img").each(function(i){
        goods_img[i] = $(this).attr('src');
    });</code>

I change the position of the pictures, but the order of the pictures obtained does not change. Is there any way to drag the pictures so that the order of the pictures obtained also changes?

After dragging into the database, update the database and refresh the page

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn