mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable: Added zIndex backCompat
This commit is contained in:
parent
34b4fbf08b
commit
d2e726d172
39
ui/jquery.ui.draggable.js
vendored
39
ui/jquery.ui.draggable.js
vendored
@ -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 );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user