OverlayManager allows you to manage multiple Overlays (and Overlay subclasses like Panel, Dialog, SimpleDialog and Tooltip) on the same page, giving focus and z-index supremacy to the focused overlay and providing you with event hooks to respond to focus and blur of your overlays with your own scripts.
Use the buttons below to show and hide the overlays in this example's OverlayManager group. Click within differnt overlays and drag them around to get a sense for how OverlayManager provides a light, operating-system-like feel to the interaction.
OverlayManager provides an easy way to manage multiple Overlays and keep track of which Overlay is currently in focus. When you register an Overlay with the OverlayManager, it is augmented with focus and blur, as well as two additional events, focusEvent and blurEvent. By default, clicking on an Overlay that is registered with the OverlayManager will bring it to the top by setting its z-index higher than all the other registered Overlays and will add the CSS class "focused" to its element.
In this tutorial, we will build three separate Panels and register them with an OverlayManager. To begin, we will instantiate three Panels that are hidden by default and render them:
Next, we will instantiate a new OverlayManager and register the Panels as an array:
Each of the Panels is then automatically augmented with focus and blur methods and events. Each Panel will be automatically focused when clicked, but we can also wire up buttons to focus and blur our Panels. The OverlayManager also has showAll, hideAll, and blurAll methods:
Finally, we will place the basic markup for our Panels, which looks identical to much of the standard module markup we've seen in previous tutorials. Note that we set the "visibility:hidden" style inline on these Panels because we don't want them to flash before they are hidden by default. Setting the style inline ensures that the Panels will not be seen in the browser until they are made visible.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.