3431e2820a
git-svn-id: https://develop.svn.wordpress.org/trunk@7974 602fd350-edb4-49c9-b593-d223f7449a82
21 lines
510 B
JavaScript
21 lines
510 B
JavaScript
jQuery(function($) {
|
|
var gallerySortable;
|
|
var gallerySortableInit = function() {
|
|
gallerySortable = $('#media-items').sortable( {
|
|
items: '.media-item',
|
|
placeholder: 'sorthelper',
|
|
update: galleryReorder
|
|
} );
|
|
}
|
|
|
|
// When an update has occurred, adjust the order for each item
|
|
var galleryReorder = function(e, sort) {
|
|
jQuery.each(sort['instance'].toArray(), function(i, id) {
|
|
jQuery('#' + id + ' .menu_order input')[0].value = i;
|
|
});
|
|
}
|
|
|
|
// initialize sortable
|
|
gallerySortableInit();
|
|
});
|