Draggable: Added zIndex backCompat

This commit is contained in:
Dave Stein 2012-12-11 19:49:41 -05:00
parent 34b4fbf08b
commit d2e726d172

View File

@ -752,4 +752,43 @@ if ( $.uiBackCompat !== false ) {
});
// zIndex option
$.widget( "ui.draggable", $.ui.draggable, {
options: {
zIndex: false
},
_create : function() {
var self = this,
originalZIndex;
this._super();
// No need to continue
if ( !this.options.zIndex ) {
return;
}
this.element.on( "dragbeforestart", function( e, ui ) {
// Cache the original zIndex of draggable element to reset later
originalZIndex = self.dragEl.css( 'z-index' );
// Set draggable element to new zIndex
self.dragEl.css( 'z-index', self.options.zIndex );
});
this.element.on( "dragstop", function( e, ui ) {
// Reset zIndex
self.dragEl.css( 'z-index', originalZIndex );
});
}
});
}