开发者

how to reflect sorting index on another list item

开发者 https://www.devze.com 2023-03-06 12:42 出处:网络
I\'ve two different lists <ul id=\"one\"> <li id=\"num_1\">One</li> <li id=\"num_2\">two</li>

I've two different lists

<ul id="one">
    <li id="num_1">One</li>
    <li id="num_2">two</li>
    <li id="num_3">Three</li>
    <li id="num_4">Four</li>
</ul>
<ul id="two">
    <li id="recordsArray_1">1: First</li>
    <li id="recordsArray_2">2: Second</li>
    <li id="recordsArray_3">3: Third</li>
    <li id="recordsArray_4">4: Fourth</li>
</ul>

I've my jQuery Codes as

$(function() {
    $("#two").sortable({ opacity: 0.6, cursor: 'move', update: function() {
    // Do stuffs                                             
}                                 
});

Here, What I want to do is, as I drag any element in #two, I want the corresponding item in #one to reflect as I drag.

Say for example I drag #recordsArray_3 to top of the list #two, then #num_3 will follow up and be placed on top of the list #one.

So can anyone开发者_如何学运维 direct me how to link the two list-items??

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号