Designing with Layers

     

Designing with Layers

Among the many advantages of layers is that you can use them to create dynamic content. When JavaScript and behaviors are added to layers, they become incredibly powerful and enable interaction with your users.

For an introduction to JavaScript and working with behaviors in Dreamweaver, see Chapter 10, "Adding Interactivity and Multimedia," page 219 .


Behaviors that can target layers include Change Property, Set Text of Layer, Show-Hide Layers, and Timelines. Layers can also be used in conjunction with other elements and behaviors to create advanced navigation systems.

Change Property

The Change Property action can be used to change the value of a layer's attributes (see Figure 9.13). You can use it to set the size , position, z-index, and other properties in recent browser versions.

Figure 9.13. The Change Property behavior is used to change the value of a layer's attributes.

graphics/09fig13.jpg

graphics/09fig13_alt.jpg


Other properties can be set as well:

  • Type of Object ” Select the kind of object you want to target. For layers, select one of the layer tags. This limits the name choices in the Named Object drop-down list.

  • Named Object ” This is a list of the objects in your document that match the type of object you choose.

  • Property ” You can select a target browser from the drop-down list on the right side, which provides a list of supported properties on the left. As an alternative, you can check Enter and enter the name of any property directly. This enables you to set properties you know about but that aren't listed as choices.

  • New Value ” Enter the value you want the property to have after the event is fired ”for instance, a new color if you're changing a color property.

Set Text of Layer

The Set Text of Layer action enables you to completely replace a layer's content with new text that you supply. This text can be any valid HTML markup, and you can even embed JavaScript statements or function calls by enclosing them in braces, like this:

 Today's date is {new Date()}. 

Show-Hide Layers

One of the most useful features of layers is their capability to be shown or hidden on demand. A page might have layers to make up pop-up menus , which become visible when the mouse is moved over the navbar buttons . The Show-Hide Layers behavior makes tying this process to a variety of events easy.

The Show-Hide Layers behavior lets you show, hide, or return to the default state any and all layers you choose with a single action.



Using Macromedia Studio MX 2004
Special Edition Using Macromedia Studio MX 2004
ISBN: 0789730421
EAN: 2147483647
Year: N/A
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net