jQuery拖放DIV选择与图像和文本 [英] jQuery drag-and-drop DIV selection with images and text

查看:142
本文介绍了jQuery拖放DIV选择与图像和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery tableDnD插件从显示用户重新排列的图像列表的表格中进行拖放列表。插件在格式表的标签上使用ID来重新排列单元格。

I'm using the jQuery tableDnD plugin to make a drag-and-drop list out of a table displaying a list of images for the user to rearrange. The plugin uses an ID on the tag of the formatting table to rearrange the cells.

当我拖放特定点击表格单元格内没有图像/内容,工作正常。但是,当我单击表格单元格的图像(或包含文本的div内部)并尝试拖动+放置时,文本/图像将被选中,重新排列脚本不会被触发。没有使用css或javascript阻止select功能 - 任何想法?

When I drag and drop specifically clicking on a spot inside the table cell with no images/content, it works fine. However, when I click on the image (or inside a div containing text) withgin the table cell and try to drag+drop, the text/image gets selected and the rearrange script is not triggered. Neither blocking the select function with css or javascript has worked - any idea?

示例tableDnD代码: http://tablednd.googlecode.com/svn-history/r12/trunk/index.html

Example tableDnD code: http://tablednd.googlecode.com/svn-history/r12/trunk/index.html

从有问题的表格中的行样本:

Sample rows from the table in question:

     <table id='imagetable'><tr id='1'><td><img src='images/6/PICT0001.JPG' width='100' class='uploadedThumb'><div class='imgInfo' onselectstart='return false;' ondragstart='return false;'>images/6/PICT0001.JPG<br><a href='admin.php?do=deleteImg&id=6&img=images%2F6%2FPICT0001.JPG' style='font-size: 9px;'>[Delete Image]</a></div><input type='text' name='6' value='' size=2 DISABLED></td>

</tr><tr id='2'><td><img src='images/6/PICT0006.JPG' width='100' class='uploadedThumb'><div class='imgInfo' onselectstart='return false;' ondragstart='return false;'>images/6/PICT0006.JPG<br><a href='admin.php?do=deleteImg&id=6&img=images%2F6%2FPICT0006.JPG' style='font-size: 9px;'>[Delete Image]</a></div><input type='text' name='6' value='' size=2 DISABLED></td>
</tr>


推荐答案

不要使用jQuery使用dom-drag更好更功能。

Don't use jQuery use dom-drag it's much better and more functional.

添加以下代码:

<script type="text/javascript" src="http://www.dynamicdrive.com/dynamicindex11/domdrag/dom-drag.js"></script>
<script type="text/javascript">
Drag.init(document.getElementById("exampleid")); //sets the id to look for to make object draggable
</script>

抱歉我误解了这个问题:(

Sorry I misunderstood the question :(

这篇关于jQuery拖放DIV选择与图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆