79433684

Date: 2025-02-12 15:58:20
Score: 0.5
Natty:
Report link

Maybe the event "receive" is an option for you?

console.clear();

$(function() {

  $(".container.one").sortable({
    axis: "y",
    items: '.box',
    connectWith: ".container.two",
    receive: function (event, ui) {      
      $('.msg').append('<div>receive from container: "'+ ui.sender[0].classList.value +'"</div>');
    }    
  });
  
  $(".container.two").sortable({
    axis: "y",
    items: '.box',
    connectWith: ".container.one",
        receive: function (event, ui) {
      $('.msg').append('<div>receive from container: "'+ ui.sender[0].classList.value +'"</div>');
    }     
  });
  
});
.container{
  width: 500px;
  border:1px solid red;
  margin-bottom:10px;
}

.box{
  border:1px solid black;
  background:#efefef;
  margin:4px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.min.js"></script>



<div class="container one">
  <div>Container One</div>
  <div class="box">ONE 1</div>
  <div class="box">ONE 2</div>
  <div class="box">ONE 3</div>
</div>

<div class="container two">
  <div>Container Two</div>
  <div class="box">TWO 1</div>
  <div class="box">TWO 2</div>
  <div class="box">TWO 3</div>
</div>

<div class="msg"></div>

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
Posted by: Ben jamin