我使用jQuery可排序插件对页面列表进行排序。用户可以按自定义顺序重新排列页面。但是,我希望占位符框包含页面在发布时将获得的页码。
如果用户的列表中有三个页面,并重新排列第二个页面,则第三个页面的占位符将显示数字三。
我该怎么做呢?
发布于 2012-03-15 00:34:41
试试这个:
$("#sortable").sortable({
placeholder: 'ui-state-highlight ui-sort-position',
helper: 'clone',
sort: function(e,ui) {
$(ui.placeholder).html(Number($("#sortable > li:visible").index(ui.placeholder)+1));
}
});
将向您显示新索引(+1) ... working demo here
https://stackoverflow.com/questions/9646831
复制相似问题