mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-24 10:09:47 +01:00
8f2a589e21
git-svn-id: http://svn.automattic.com/wordpress/trunk@7974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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();
|
|
});
|