summaryrefslogtreecommitdiffstats
path: root/wp-admin/js/gallery.js
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin/js/gallery.js')
-rw-r--r--wp-admin/js/gallery.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/wp-admin/js/gallery.js b/wp-admin/js/gallery.js
index f29573b..ed988dc 100644
--- a/wp-admin/js/gallery.js
+++ b/wp-admin/js/gallery.js
@@ -4,6 +4,8 @@ jQuery(function($) {
gallerySortable = $('#media-items').sortable( {
items: '.media-item',
placeholder: 'sorthelper',
+ axis: 'y',
+ distance: 2,
update: galleryReorder
} );
}
@@ -11,10 +13,16 @@ jQuery(function($) {
// When an update has occurred, adjust the order for each item
var galleryReorder = function(e, sort) {
jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
- jQuery('#' + id + ' .menu_order input')[0].value = i;
+ jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
});
}
// initialize sortable
gallerySortableInit();
});
+
+jQuery(document).ready(function($){
+ $('.menu_order_input').each(function(){
+ if ( this.value == '0' ) this.value = '';
+ });
+});