Answers for "jquery sortable on div drag and drop"

0

jquery sortable on div drag and drop

var oldContainer;
$("ol.nested_with_switch").sortable({
  group: 'nested',
  afterMove: function (placeholder, container) {
    if(oldContainer != container){
      if(oldContainer)
        oldContainer.el.removeClass("active");
      container.el.addClass("active");

      oldContainer = container;
    }
  },
  onDrop: function ($item, container, _super) {
    container.el.removeClass("active");
    _super($item, container);
  }
});

$(".switch-container").on("click", ".switch", function  (e) {
  var method = $(this).hasClass("active") ? "enable" : "disable";
  $(e.delegateTarget).next().sortable(method);
});
Posted by: Guest on April-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language