| By Benny Alexander | Article Rating: |
|
| December 20, 2005 04:30 PM EST | Reads: |
15,895 |
Layers are a special kind of HTML elements that can be used as a container to hold other HTML elements and to show them dynamically using JavaScripts. We can stack more than one layer on top of each other. One or more layer can be made visible dynamically, by hiding others. But using Macromedia Dreamweaver you can do all this without even knowing JavaScript or coding.
In this tutorial we are going to use multiple layers stacked over one another, and make it viewable, when you mouseover an image. In this case study I have taken 2 rollover images: Image1, Image 2, and three layers: Layer1, Layer2 and Layer3.
When we mouse over on the Image1, the second layer will appear while Layer1 and Layer 3 will be hidden along with its content. Likewise for the Image 3, Layer1 and 2 will be hidden and only Layer3 will appear with its content. When we mouse out from the images, Layer 1 will come up again.
To achieve this follow the steps and enjoy!
1. Creating rollover Images
First as I said let us create 2 Images. We can use Macromedia Fireworks to create the images. In our case I have designed 4 buttons; 2 for the up state and 2 for the down state.
After designing the buttons, open a new page in Dreamweaver and create a 2X1 table. Now Insert the images using, Insert>Interactive Images>Rollover Image. Browse and select the first one for the up state and the second one for the down state. ( I am assuming you have put the images in the proper folder.)
Now do the same for the next image, so that both the images are in the first column of the table as shown in this example.
2. Placing Layers
Open Insert>Layer and place the Layer1. Move the layer into column2 of the table. Now you can write the content inside the Layer. Select the layer in the Properties Inspector and select Overflow as 'visible'. This makes this first layer the default layer and makes it visible while the page is being loaded.
Note down the position of the Layer (566px and 163px). Insert the second and third layers on the same position, so that they will sit over the first layer.
Now insert the text on those layers. (Note: Due to the overlapping of layers the text may not be clear. So, you can place the layers somewhere else, write down the text and then change the position of the layers to sit on the same position as the first layer.)
3. Changing the Layer Properties
Select Window>Layers. You will get the Layer Inspector, with all the three layer details. Select Layer2 and Layer3 and if the eye is open click on it to close it for both of them. In the properties Inspector you can see the OverFlow is selected as hidden for Layer2 and Layer3. This enables Layer2 and 3 to be hidden while the page is loaded.
4. Adding Behaviors
Now select the Image1 where we are going to add the dynamic Layer effects. Then Open Window > Behavior. You can see the Events and actions created by Dreamweaver for the Rollover Images which we did in step 1.
Click on the button and select "Show-hide Layers". You will get this box to 'Show or Hide" the Layers.
Now do the following:
a. Select Layer1 than click on 'Hide'
b. Select Layer2 and click on 'Show' then,
c. Select Layer3 and click on 'Hide'.
This action will make Layer1 and 3 disappear and show Layer2 whenever you mouseover Image1.
You can also see the new JavaScript events created by Dreamweaver in the Behaviors Inspector. Here the new onMouseOver and onMouseOut with Show-hide Layers as actions.
Note here that you can use other events also as you like. For example instead of onMouseOver you can use onClick. To do this you need to click on the tiny black, inverted arrow next to the event. Use this to select other events, ie OnClick, Down etc.,.
At the foot of the list there is a category which allows you to choose which browsers to support, make sure a check is next to 4 and higher browsers. (Only after choosing the browser 4 or higher you will be able to see all the Events in a list)
Follow step 4 by selecting Image2. Then,
a. Select Layer1 than click on 'Hide';
b. Select Layer2 and click on 'Hide' then,
c. Select Layer3 and click on 'Show'.
This action will make the Layer1 and Layer2 disappear and show Layer2 while you move your mouse over Image1.
5. Bringing Default Layer Again
Now as a final step, you need to bring back Layer1 when you move your mouse out of the Image (or when you mouse away from the images to somewhere on that page). Select Image1 and click on the button and select "Show-hide Layers". You will get a box to 'Show or Hide" the Layers.
Now do the following...
a. Select Layer1 than click on 'Show'
b. Select Layer2 and click on 'Hide' then,
c. Select Layer3 and click on 'Hide'.
This action will make Layer2 and Layer3 disappear and show Layer1 while you move your mouse out of the Image1. Also do not forget to change the Events to onMouseOut.
Repeat step 5 with Image2 also. Now you should get the Behavior Inspector like this Image, showing all the Events for both Image1 & Image2.
Published December 20, 2005 Reads 15,895
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Benny Alexander
Benny Alexander is lead developer with Macronimous.com, an offshore web design company focusing on quality Web and PDA application development services at low costs and serving the needs of small to medium businesses.
- Cloud People: A Who's Who of Cloud Computing
- AMD and Adobe Collaborate on Upcoming Version of Adobe Premiere Pro Software to Enable Breakthrough Video Editing Performance Through Open Standards
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Business Solutions, Social Media, and Platform Systems of Engagement Market Shares, Strategies, and Forecasts, Worldwide, 2013 to 2019
- ExtraHop Named a Best of Interop 2013 Finalist for Two Awards: Best Cloud and Virtualization Product and Best Monitoring and Management Product
- Interop Las Vegas Previews News Announcements from over 60 Exhibitors & Sponsors
- BrightScope Releases Top 25 Technology Companies With the Best 401k Plans
- Adobe Drives Innovation With New Video Workflows at NAB 2013
- Research and Markets: Cloud Business Solutions, Social Media, and Platform Systems of Engagement
- This Week in Cloud, May 9, 2013: U.K. issues cloud-first policy, Dell acquires Enstratius, OpenStack’s growing pains. And more…
- Mobile Commerce News Weekly – Week of May 5, 2013
- TeamDrive Partners with SmartOffice to Offer First Office Productivity Solution with End-to-End Encryption
- Cloud People: A Who's Who of Cloud Computing
- AMD and Adobe Collaborate on Upcoming Version of Adobe Premiere Pro Software to Enable Breakthrough Video Editing Performance Through Open Standards
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Apple Makes Highly Eccentric Hire
- Cloud Business Solutions, Social Media, and Platform Systems of Engagement Market Shares, Strategies, and Forecasts, Worldwide, 2013 to 2019
- Global eLEARNING Industry
- ExtraHop Named a Best of Interop 2013 Finalist for Two Awards: Best Cloud and Virtualization Product and Best Monitoring and Management Product
- Interop Las Vegas Previews News Announcements from over 60 Exhibitors & Sponsors
- BrightScope Releases Top 25 Technology Companies With the Best 401k Plans
- How to Get Full Value in a Flash Upgrade
- SMAC News Weekly – Week of March 10, 2013
- Top Web Application Security Questions to Ask Third Party Developers
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- How To Create a Photo Slide Show ...
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Personal Branding Checklist
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Adobe/Macromedia - Microsoft, Look Out!
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets



























