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.
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 ins开发者_如何转开发ide 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?
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>
Don't use jQuery use dom-drag it's much better and more functional.
Add this code:
<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 :(
精彩评论