javascript - Sort one list based on the order of a second list -


i'm new jquery , struggling work out how solve problem.

i have 2 unordered lists, list , list b. list sortable using .sortable({ axis: 'y' }) method. when list reordered, automatically reorder list b (which not user sortable) reflect changes in list a.

i'm struggling know start, if can help, appreciated.

thanks

update: here's code page put things context.

<div class="cvoverview">                 <h4>cv overview</h4>                 <ul class="sortable" id="lista">                     <li id="item_1" class="editcontent"><span></span>about me</li>                     <li id="item_2" class="editcontent"><span></span>personal profile</li>                     <li id="item_3" class="editcontent"><span></span>employment history</li>                     <li id="item_4" class="editcontent"><span></span>skills &amp; qualities</li>                 </ul>                 <p class="backbutton editbutton"><a href="cv.html" title="#"><span>completed</span></a></p>             </div> <div class="cvmaincontent">                 <h3>dean bates</h3>                  <ul class="sortable" id="listb">                     <li id="item1">                          <div class="cvcontactdetails">                             text here                         </div>                     </li>                     <li id="item2">                         <div class="cvpersonalprofile">                             text here                         </div>                     </li>                     <li id="item3">                         <div class="cvemploymenthistory">                             text here                         </div>                     </li>                     <li id="item4">                          <div class="cvskillsfromjobs">                             text here                        </div>                     </li>                 </ul>              </div> 

the 2 lists contain same items , same number of items, i'd add functionality if list item deleted or inserted list a, corresponding item deleted or added list b.

from design point of view, list represents overview user of what's in list b, can re-order , change contents of simplified list on 1 side , have these changes reflected in more detailed list on other.

hope helps.

thanks again help.

use update event sort other list

$( ".selector" ).sortable({    update: function(event, ui) { ... } }); 

then need loop thru' first list , move items in second list, if supply html / js might able that.

try jsfiddle.com


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -