Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

dreamweaver course london - layers

Forum home » Delegate support and help forum » Dreamweaver Training and help » dreamweaver course london - Layers

dreamweaver course london - Layers

ResolvedVersion Standard

Karen has attended:
Dreamweaver 8 Introduction course
Project Introduction course
Project Intermediate course

Layers

have created a menu on the left hand side of my page and I want to create dropdown options which appear under them either when you click on the main heading or when you hover over it with your mouse. How do I do this as at the moment I can only create ones that are there all the time.

RE: Layers

Karen,

This is indeed a tricky one!

Around this web site, we use javascript functions to accomplish this, and because it's all viewable in our source code, there is no need to hide it away from you or anyone else!

First, save this into a javascript file (eg. global.js)



var supported = (document.getElementById || document.all);
if (supported) {
// set all to be initally false (ie. not shown / none)
var max = 7;
var shown = new Array();
for (var i=1;i<=max;i++) {
shown[i+1] = false;
}
}

function blocking(i) {
if (!supported) {
alert('Sorry, this link does not work in your browser.');
return;
}
// reverse current state
shown[i] = (shown[i]) ? false : true;
// set css display value
current = (shown[i]) ? 'block' : 'none';
// set
currentimg = (shown[i]) ? 'on' : 'off';
if (document.getElementById) {
document.getElementById('comment_'+i).style.display = current;
}
else if (document.all) {
document.all['comment_'+i].style.display = current;
}
}

Then, whenever you want an 'expand' doovy, use this code:



<a href="" onClick="blocking(RANDOM NUMBER); return false">Click me to expand</a>
<div class="comment_off" id="comment_RANDOM NUMBER">
Whatever you want to reveal here
</div>

Then ensure you have this CSS code on all your pages



comment_off {
display: none;
}

You'll also need to link your HTML file to the javascript file in the HEAD part of your document (template is best), like this:
<script language="javascript" type="text/javascript" src="/asset/script/global.js"></script>

This assumes your javascript file is in a folder asseet/script.

Hope this helps!

Regards, Rich

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Dreamweaver tip:

Paragraph formatting

in Dreamweaver if you type in text and press entre you get double line spacing.

To avoid this hold down the shift key and then press Enter for a soft break

View all Dreamweaver hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.