Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d4d1400f5f
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (44 sloc) 1.437 kb
<!--
A control that covers the entire viewport, typically to swallow clicks.
-->
<Control className="Overlay" generic="true">
<style>
{
bottom: 0;
cursor: default;
position: fixed;
top: 0;
left: 0;
right: 0;
}
</style>
<script>
Overlay.prototype.extend({
/*
* The target of the overlay is the element which will end up visually
* in front of the overlay.
*
* Setting the target adds the overlay to the DOM (or moves it, if already
* in the DOM) to come before the target element. The result of this is that
* the overlay will sit visually behind the target.
*
* If there are elements with a z-index in the same stacking context as the
* target, the target should also have a z-index applied to it. The
* overlay will pick up this same z-index. As long as the target element
* visually appears in front of the other elements, so too will the overlay.
*/
target: Control.property( function( target ) {
if ( target === null ) {
// Clearing target; nothing to do right now.
return;
}
var targetZIndex = parseInt( target.css( "z-index" ) );
if ( targetZIndex ) {
// Overlay gets same z-index as target.
this.css( "z-index", targetZIndex );
}
return this.insertBefore( target );
})
});
</script>
</Control>
Jump to Line
Something went wrong with that request. Please try again.