问题标签 [draggable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1702 浏览

javascript - 如何在 Scriptaculous 中创建可嵌套的可拖动对象?

我正在使用 Scriptaculous 库在帮助最终用户构建列表的应用程序上打造吸引人的 UI。让我们说它用于披萨制作。

要填写订单,您可以将披萨调色板中的披萨尺寸拖到可放置的订单中。一旦它被放在那里,它就会被一个新的 div 替换,该 div 既可拖动(因为您可以通过将其移回调色板来将其丢弃)和可放置(因为您可以向其中添加成分)。

然后,您可以将配料调色板中的配料添加到订单组中的任何比萨饼。

我已经成功实现了这些位并且一切正常。坚持者:如果我尝试从放置的比萨中拖放配料,该比萨被正确标记为可拖动,并且,从良好的角度来看,它位于比萨上方的 z 轴上,它反而会抓取比萨批发。这使我无法撤消成分选择,这是此屏幕的一个关键功能。

关于如何让它做我想做的任何建议?理想情况下,我希望保留简单的拖拽式 UI,因为它比我们以前使用的更直观(一个多阶段的 HTML 表单……不寒而栗……)

0 投票
7 回答
14251 浏览

jquery - jQuery Safari/Chrome 与可拖动的包含属性不兼容

此代码适用于 Firefox、Internet Explorer,而不适用于 Safari/Chrome:

在 Safari/Chrome 中,divNew 只能垂直移动。jQuery的这个功能目前不兼容?我使用的是 1.5.2 稳定版。可以在这里找到jQuery 1.5.2

0 投票
2 回答
12349 浏览

jquery - jQuery droppables - 在放置时更改元素

我对 jQuery 有点陌生,希望有人能帮助我。

在删除 (li) 之后,我试图将一个元素 (li) 更改为另一个元素 (div)。

示例代码:

问题是,当我使用

触发上述功能时,将禁用原始可拖动元素。

我正在使用最新的 jQuery 和 jQuery UI 稳定版本。

0 投票
2 回答
3370 浏览

jquery - 在 Internet Explorer(IE) 中可拖动的 jquery ui - 对象不支持此方法

当我尝试在 IE 中执行以下代码时:

我收到以下错误消息:

对象不支持此属性或方法

为什么我会收到此错误?

0 投票
4 回答
12712 浏览

javascript - jQuery: Creating a circular slider

You may have seen JavaScript sliders before:

http://dev.jquery.com/view/tags/ui/1.5b2/demos/ui.slider.html

What I'm envisioning is a circular slider. It would consist of a draggable button at one point on the circle -- and that button can be dragged anywhere along the ring. The value depends on what position the button is at (think of a clock).

0 投票
3 回答
1741 浏览

iframe - iFrame 导致 IE7 中的脚本拖拽问题(包括完整代码)?

当我在 IE7 中的 iframe 上拖动可拖动 div 内的链接时,我得到了非常奇怪的结果。试试下面的代码,如果你对如何解决这个问题有任何建议,请告诉我。

0 投票
2 回答
630 浏览

javascript - Drawing a caret between a point and a draggable div

I have a draggable div that represents a little info popup that the user can drag around the screen. But this div is anchored to a point on the screen, and I would like there to be a caret drawn between the div and the point that it is anchored to.

An example of this can be found on Google maps, when you hover over a store or point of interest that you've searched for. You'll see a caret drawn between the point and the popup. This is simple enough, but their popup is not draggable while mine is.

So what is the best way to implement this? I'm thinking of using a series of caret images that are resized depending on the orientation of the popup relative to the anchor point. It'll get tricky in that I'll have to use a different type of caret depending on the angle at which the popup is placed relative to the anchor. Is there a better way to do this?

Thanks!

0 投票
2 回答
7100 浏览

javascript - 具有多个句柄的 Jquery Draggable

是否可以有一个draggable具有多个手柄的元素?

我将它初始化两次,每次都使用不同的句柄参数,但它不起作用 - 只有第一个起作用。

0 投票
1 回答
1826 浏览

javascript - jQuery UI Sortable connectWith 日历上的加载时间性能

jQuery UI 可排序 + 可拖动 1.6rc5

我在做什么:创建具有不同日期范围的日历(例如:可能显示 1 周,可能显示 20 周)。此日历每天都有事件,事件可在当天本身以及可见日历上的所有其他日期之间排序。我的平均日历日期范围约为 10 周,其中包括大约 50 个事件。

问题:对于日历上的每一天,jQuery 的 Sortable 交互需要一定的时间来设置。可见的天数越多,jQuery 应该对其应用 Sortable,页面加载所需的时间就越多。加入选项“connectWith”以将所有日历日连接在一起作为交互的可排序列表。并且页面需要大约 10 倍的时间来加载。对于 10 周,50 事件示例,页面加载大约需要 50 秒。

代码:

日历代码如下所示:

设置可排序交互:

我在寻找什么:页面加载时更快的加载/设置时间。我将继续查看可排序的源,但似乎没有很多可排序的选项可以优化交互设置时间。

0 投票
2 回答
2776 浏览

jquery - jquery 拖放问题:drop() 函数永远不会被调用

我在 jquery 1.3.1(UI 版本 1.5.3)中的可放置效果遇到问题。据我所知,除了 drop() 函数没有被调用之外,一切都运行良好。我可以告诉可放置目标正在接受被拖动的元素(通过缩略图类),但可拖动项目不会下降。提前感谢您的帮助!