简体   繁体   English

使用JavaScript在浏览器上拖放控件

[英]Drag and drop of controls on browser using javascript

I am displaying some controls on page. 我在页面上显示一些控件。 My requirement is in browser client can able to change the position of controls. 我的要求是在浏览器客户端中可以更改控件的位置。 How can achieve this through JavaScript 如何通过JavaScript实现

I think the easiest way is to adopt existing JS frameworks like jQuery UI to implement this feature as dragging/dropping is built into it. 我认为最简单的方法是采用jQuery UI这样的现有JS框架来实现此功能,因为它内置了拖放功能。 Link : 连结:

http://jqueryui.com/demos/draggable/ http://jqueryui.com/demos/draggable/

基本上,您希望将元素的位置绑定在mousedown上的鼠标光标上,然后将其放在鼠标上方的目标位置。

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

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