Share this Page URL

Chapter 15. Using Layers > Using Behaviors to Control Layers - Pg. 255

Using Layers 255 Using Behaviors to Control Layers The final piece of the puzzle is to make layers interactive. Layers are usually invisible by default, and in order to make them useful, you need to make them visible at some point. Using FrontPage behaviors, you can control the visibility and even the position of a layer in response to an event. Like other elements such as rollover buttons, you need to make your layers respond to events, such as mouse clicks, to trigger an action. But because layers are typically not displayed by default, you must use an event on another object, such as an image, to make the layer visible using either the onmouseover or onmousedown event. To hide the layer again, you can close it either by assigning an onmouseout event to the layer itself or by requiring that the original image be clicked again to close the layer. The combination of rollover buttons and layers makes it easy to create exciting dynamic menus that show and hide themselves based on the selected item with very little work. Follow these steps to see how to add dynamic drop-down menus to the menu created in the previous section: 1. 2. Create the buttons for your main menu items. These can be rollover buttons or just normal images. We'll use the interactive buttons we created in the previous chapter. Create a layer for each of your submenus. Give them hidden visibility by default, and position them either below or to the side of the buttons that will activate them, as shown in Figure 15.8.