我正在尝试使用Gridster,即 jQuery 拖放库。但是,我的 HTML 的结构与此 JSFiddle ( http://jsfiddle.net/twashing/4xc6s/5/ ) 中的结构相同。而且我无法让gridster工作。即,不会发生拖放行为。
我的 HTML 结构有 div,而不是在无序列表 (ul > li) 中列出项目。i)我想让 .section-box 类可拖动,并相互替换。我怎样才能用 Gridster 做到这一点?
ii)除此之外,如果可能的话,我什至可以使表格行( tr )元素成为可拖动的东西。
JSFiddle:http: //jsfiddle.net/twashing/4xc6s/5/
HTML
<tbody>
<tr style="" class="ready">
<td style="position: relative;">
<div class="edit-section" style="">Planet of the Apes</div>
</td>
</tr>
<tr data-id="15AE995E-2630-A314-81EB-DB1C46F147F4" style="" class="ready">
<td style="position: relative;">
<div class="section-box grid-top-row" data-id="1" data-row="1" data-col="1" >
<div class="section-box-overlay" >1</div>
</div>
</td>
</tr>
<tr class="vertical-line ready" style="">
<td style="position: relative;">
<div class="vertical-line-left"></div>
<div class="vertical-line-right"></div>
</td>
</tr>
<tr data-id="CE29FFE8-4A61-CE84-0137-E2464705C588" style="" class="ready">
<td style="position: relative;">
<div class="section-box" data-id="2" data-row="2" data-col="1" >
<div class="section-box-overlay" >2</div>
</div>
</td>
</tr>
<tr class="vertical-line ready" style="">
<td style="position: relative;">
<div class="vertical-line-left"></div>
<div class="vertical-line-right"></div>
</td>
</tr>
<tr style="" class="ready">
<td style="position: relative;">
<div class="section-box-add">
<div class="section-box-add-label"></div>
<div class="box-label" style="color: rgb(95, 95, 97);">Add a related screen
<br>to this section</div>
</div>
</td>
</tr>
</tbody>
Javasctipt
$(function() {
$("tbody > tr > td").gridster({
widget_margins: [5, 5]
})
});
谢谢