[英]How to move an item from one list to another?
我是一名新手,试图学习如何构建jQuery Mobile App,并且我有一些项目列表,我希望将它们拖曳到不同页面上的不同列表中。 我已经能够弄清楚如何使用
$('document').ready(function() {
$('.theListItem .red').click(function() {
var $toRemove = $(this).closest('div[data-theme="a"]')
$toRemove.animate({
height: 0
}, 500, function() {
// This is the callback.
$toRemove.remove();
});
return false;
});
});
但是如果我想移动整个物品
<div data-role="collapsible" data-collapsed="false" data-theme="a">
<h3>Section 1</h3>
<div data-role="controlgroup" data-type="horizontal">
<a href="categorize.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Maybe</a>
</div>
到具有完全相同功能的其他列表,您如何建议我这样做? 非常感谢。
我认为最好的方法是从JavaScript对象动态绘制列表。 具体来说,如果您有两个列表A和B,则可能会有一个表示每个列表的字符串数组。 每次列表之间移动的项目时,你只是执行操作上的两个阵列然后从这些阵列重新绘制你的清单。
我希望这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.