0

I have to implement sortable functionality for selected element . The whole scenario is as follows :-

$("#sortable").sortable({
  revert: true,
  stop: function(event, ui) {
    if (!ui.item.data('tag') && !ui.item.data('handle')) {
      ui.item.data('tag', true);
      //ui.item.fadeTo(400, 0.1);
    }
  }
});
$('.ImageDiv').live('click', function(eve) {
  if (eve.ctrlKey || eve.metaKey) {
    $(this).toggleClass('selectedDiv');
  }
});
.ImageDiv {
  background-color: #FFFFFF;
  border: 1px solid #C1C1C1;
  border-radius: 4px 4px 4px 4px;
  box-shadow: 2px 2px 2px #CCCCCC;
  display: block;
  float: left;
  min-height: 40px;
  margin-bottom: 5px;
  margin-right: 5px;
  padding: 7px;
  min-width: 40px;
}
.selectedDiv {
  border: 1px solid #3399FF;
}


<table>
  <tr>
    <td id="sortable">
      <div class="ImageDiv">1</div>
      <div class="ImageDiv">2</div>
      <div class="ImageDiv">3</div>
      <div class="ImageDiv">4</div>
      <div class="ImageDiv">5</div>
      <div class="ImageDiv">6</div>
      <div class="ImageDiv">7</div>
      <div class="ImageDiv">8</div>
      <div class="ImageDiv">9</div>
      <div class="ImageDiv">10</div>
      <div class="ImageDiv">11</div>
      <div class="ImageDiv">12</div>
      <div class="ImageDiv">13</div>
    </td>
  </tr>
</table>

Single div sortable is working fine ,here My task is to sort(drag) Selected Div(Multiple) at a time (in one drag).Selection of DIV tag can be done by CTRL+CLICK

I had googled for the solution but I was unable to find the exact solution to this task. I have done the code on Jsfiddle ,the jsfiddle link :-.

Jsfiddle

It would be so thankful for fast reply. Thanks in advance

9
  • 2
    did you ask a question? Commented Dec 30, 2014 at 5:08
  • 1
    What exactly is your issue? Where is the question? Commented Dec 30, 2014 at 5:28
  • Here is a working demo I found on the internet.. jsfiddle.net/ma4b45x9 Commented Dec 30, 2014 at 5:45
  • @VJS Yes i had seen this demo,but it is not working for my html structure.It working fine for ul li html Commented Dec 30, 2014 at 6:06
  • possible duplicate of jQuery Sortable - Select and Drag Multiple List Items Commented Dec 30, 2014 at 6:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.