在此示例中repeatable custom fields, 我们可以看到,需要以下jQuery:
$(\'#repeatable-fieldset-one tbody\').sortable({
opacity: 0.6,
revert: true,
cursor: \'move\',
handle: \'.sort\'
});
它控制的HTML是(简化的):
<table id="repeatable-fieldset-one" width="100%">
<thead>
<tr>
<th width="2%"></th>
<th width="30%">Name</th>
<th width="60%">URL</th>
<th width="2%"></th>
</tr>
</thead>
<tbody>
<?php
if ( $repeatable_fields ) :
foreach ( $repeatable_fields as $field ) {
?>
<tr>
<td><a class="button remove-row" href="#">-</a></td>
<td>NAME FIELD</td>
<td>URL FIELD</td>
<td><a class="sort">|||</a></td>
</tr>
<?php
}
endif;