jQuery draggable表元素 [英] jQuery draggable table elements
问题描述
jQuery的 draggable
功能似乎不适用于表格(在FF3或Safari)。很难想象这将如何工作,所以它不是真的不奇怪。
< html>
< style type ='text / css'>
div.table {display:table; }
div.row {display:table-row; }
div.cell {display:table-cell; }
< / style>
< script src =http://code.jquery.com/jquery-latest.js>< / script>
< script src =http://dev.jquery.com/view/tags/ui/latest/ui/ui.core.js>< / script>
< script src =http://dev.jquery.com/view/tags/ui/latest/ui/ui.draggable.js>< / script>
< script>
$(document).ready(function(){
$(。row)。draggable();
});
< / script>
< body>
< div class ='table'>
< div class ='row'>
< div class ='cell'> Foo< / div>
< div class ='cell'>栏< / div>
< / div>
< div class ='row'>
< div class ='cell'>垃圾邮件< / div>
< div class ='cell'> Eggs< / div>
< / div>
< / div>
< table>
< tr class'row'>< td> Foo< / td>< td>酒吧< / td>< / tr>
< tr class ='row'>< td>垃圾邮件< / td>< td> Eggs< / td>< / tr>
< / table>
< / body>
< / html>
我想知道a)如果有任何具体原因, w3c / HTML spec透视图)和b)获取可拖动表行的正确方法是。
我喜欢真正的表,因为边界折叠和行高算法
如果你有真正的表格数据,你应该坚持使用表
如果您要在表中拖曳列,请输入 JQuery +可拖动行表库 在FireFox3中工作完美 jQuery's I'm was wondering a) if there's any specific reason why this doesn't work (from a w3c/HTML spec perspective) and b) what the right way to go about getting draggable table rows is. I like real tables because of the border collapsing and row height algorithm -- any alternative that can do those things would work fine. If you have truly tabular data, you should stick with table indeed. And if you want to drag rows within a table, this JQuery + "draggable row table" library works perfectly in FireFox3 这篇关于jQuery draggable表元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!draggable
functionality doesn't seem to work on tables (in FF3 or Safari). It's kind of difficult to envision how this would work, so it's not really surprising that it doesn't.<html>
<style type='text/css'>
div.table { display: table; }
div.row { display: table-row; }
div.cell { display: table-cell; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.core.js"></script>
<script src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.draggable.js"></script>
<script>
$(document).ready(function(){
$(".row").draggable();
});
</script>
<body>
<div class='table'>
<div class='row'>
<div class='cell'>Foo</div>
<div class='cell'>Bar</div>
</div>
<div class='row'>
<div class='cell'>Spam</div>
<div class='cell'>Eggs</div>
</div>
</div>
<table>
<tr class'row'><td>Foo</td><td>Bar</td></tr>
<tr class='row'><td>Spam</td><td>Eggs</td></tr>
</table>
</body>
</html>