将鼠标悬停在固定的HTML元素上时,防止JQuery可排序传播

时间:2022-11-28 08:36:09

I'm trying to figure out how to prevent sortable dragging and propagation when hovering over a fixed element at the bottom of the page.

我试图弄清楚当将鼠标悬停在页面底部的固定元素上时如何防止可排序的拖动和传播。

Off hand, I'm not sure what the best & simplest way to do this would be.

在手边,我不确定最好和最简单的方法是什么。

I've created a simple example outlining the issue here: http://jsfiddle.net/arpowers/kSCQU/1/

我在这里创建了一个简单的例子概述了这个问题:http://jsfiddle.net/arpowers/kSCQU/1/

Sortable code:

jQuery('.sortable_area').sortable({
  items: ".sortable",
  dropOnEmpty: true,
  forcePlaceholderSize: true,
  forceHelperSize: false,
  connectWith: ".column",
  placeholder: "placeholder",
  cursor: "move",
  tolerance: "pointer",
});​

And there is a simple HTML element fixed to the footer of the page.

并且有一个简单的HTML元素固定到页面的页脚。

1 个解决方案

#1


1  

Sortable has an option containment. Set containment: '.container' while initializing your sortable element and add the property margin-bottom: 251px; in the class container (the fixed part total height). Then the element cannot be on your fixed part and it should prevent any event raised from sortable.

Sortable有一个选项包含。在初始化可排序元素时添加'.container'并添加属性margin-bottom:251px;在类容器中(固定部分总高度)。然后元素不能在您的固定部分上,它应该防止任何由sortable引发的事件。

#1


1  

Sortable has an option containment. Set containment: '.container' while initializing your sortable element and add the property margin-bottom: 251px; in the class container (the fixed part total height). Then the element cannot be on your fixed part and it should prevent any event raised from sortable.

Sortable有一个选项包含。在初始化可排序元素时添加'.container'并添加属性margin-bottom:251px;在类容器中(固定部分总高度)。然后元素不能在您的固定部分上,它应该防止任何由sortable引发的事件。