Skip to content

Instantly share code, notes, and snippets.

@juareznjunior
Created June 27, 2014 14:16
Show Gist options
  • Save juareznjunior/9cd408aebf4ee110897f to your computer and use it in GitHub Desktop.
Save juareznjunior/9cd408aebf4ee110897f to your computer and use it in GitHub Desktop.
_createOverlay: function() {
if ( !this.options.modal ) {
return;
}
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling (#2804)
var isOpening = true;
this._delay(function() {
isOpening = false;
});
var countOverlays = ( this.document.data( "ui-dialog-overlays" ) || 0 );
if ( 0 === countOverlays ) {
// Prevent use of anchors and inputs
// Using _on() for an event handler shared across many instances is
// safe because the dialogs stack and must be closed in reverse order
this._on( this.document, {
focusin: function( event ) {
if ( isOpening ) {
return;
}
if ( !this._allowInteraction( event ) ) {
event.preventDefault();
this._trackingInstances()[ 0 ]._focusTabbable();
}
}
});
}
this.overlay = $( "<div>" ).addClass( "ui-widget-overlay ui-front" );
if ( countOverlays > 0 ) {
this.overlay.css('z-index', +this.overlay.css('z-index') + countOverlays)
}
this.overlay.appendTo( this._appendTo() );
this._on( this.overlay, {
mousedown: "_keepFocus"
});
this.document.data( "ui-dialog-overlays",(countOverlays + 1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment