简体   繁体   English

html5 draggable - 任意下降位置?

[英]html5 draggable - arbitrary drop position?

All the examples that I've seen with draggable elements have a specific destination where the draggable element can be dropped. 我在draggable元素中看到的所有示例都有一个特定的目标,可以删除可拖动的元素。 Is it possible to drop the element anywhere on the screen without specifying the destinations? 是否可以在不指定目的地的情况下将元素放在屏幕上的任何位置?

I have a map (ThinkGeo) with some specific areas coming from the database. 我有一个地图(ThinkGeo),其中包含来自数据库的一些特定区域。 when the user clicks/touches those areas, I'm showing popups with description of those areas. 当用户点击/触摸这些区域时,我会显示带有这些区域描述的弹出窗口。 The popup is nothing else than a div that I'm showing and hiding accordingly. 弹出窗口只不过是我正在展示和隐藏的div。

The user wants to be able to move around the popup div on the map. 用户希望能够在地图上移动弹出div。 Is this even possible? 这甚至可能吗?

Certainly possible and pretty easy with jQuery UI: 使用jQuery UI当然可以轻松实现:

$("#elementId").draggable();

And a shim for touch events: 触摸事件的垫片:

http://touchpunch.furf.com/ which at 584 bytes, is pretty lightweight. http://touchpunch.furf.com/,584字节,非常轻巧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM