没有 JQuery UI 的拖放

Drag and drop without JQuery UI(没有 JQuery UI 的拖放)
本文介绍了没有 JQuery UI 的拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我搜索了很多内容以找到有关拖动 & 的教程.drop 单独使用 jQuery(没有 UI),但是由于 JQuery UI 的流行,所有的拖放功能都基于 JQuery UI.

I searched a lot to find a tutorial for drag & drop with jQuery alone (without UI), but due to the popularity of JQuery UI, all drag and drop features are based on JQuery UI.

谁能给我一个提示如何制作一个基本的 Drag &单独使用 JQuery 吗?

Can anyone give me a hint how to make a basic Drag & Drop by JQuery standalone?

推荐答案

我认为一个好的起点可能是规划流程,然后决定每个用户操作需要使用哪些 jQuery 工具.

I think a good starting place might be to map out the process, and then decide which jQuery tools you will need to use for each user action.

所以用户进程可能是:

  • 在可拖动"区域点击您的内容 div
  • 拖动内容,将内容保留在该 div 中
  • 松开鼠标,将内容放入可放置"容器中,该容器将调整之前内容的大小以适应可放置大小

需要以下类型的事件监听器:

which needs the following types of event listeners:

  • 鼠标移动
  • 鼠标按下
  • 动画

至少.另一种选择可能是查看 jQuery UI 源代码,看看他们是如何做到的!这将告诉您确切的操作,但您可以在必要时添加或修剪.

At the very least. Another option might be to check out the jQuery UI source, and see how they do it! Which will tell you exactly what to do but you can add to it or trim where necessary.

这篇关于没有 JQuery UI 的拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
Ordinals in words javascript(javascript中的序数)