Forum Moderators: open
Say I have a bunch of images on top of my page representing the main menu (navigation). What I want to happen is when I move the mouse over (or click) on a menu item, a sub menu would appear below that. Can this be done using layers? The submenu would also be graphics using javascript to represent mouse overs.
Thanks.
Otherwise looke here: [google.com...]
Hope this helped
Leo
Note: I've noticed many scripts like this (js & layer menu effects) tend to render strangely in Opera, if that's a concern. Even if they say cross-browser friendly, it's always best to test the heck out of them.
BlobFisk, I understand what you are saying in principle, but I still have yet to actually do it. Sorry, but I'm still a newbie--- you can say learning everything at the same time.
idiotgirl, how do you do that in dreamweaver? I haven't checked with Opera yet, but I will download Opera. I've heard of such problems but I haven't checked that yet. Thanks for that. If you can also tell me (or provide a link) on how to do that in Dreamweaver.... it will be great.
Thanks a bunch.
Francis
Well, it's defenitely something worth looking into. With CSS, JavaScript and some DOM manipulation you do some some pretty powerful things.
A function to switch the visibility of a layer is quite simple to write. For example:
function showLayer(layerName)
{
document.getElementById(layerName).style.visibility='visible';
} Similarly, to toggle the visibility off, it would be style.visibility='hidden'. This code is for DOM1 browsers only, a little work is needed to make it compliant in older browsers - but it is possible.
In your html, you would use onmouseover="showLayer('your name')". The script can be extended to put a time delay on hiding the layer.
The beauty about this system of navigation is that you can put whatever you want in the pop-up menu layer. A lot of the free-for-use scripts limit you to text only.
function show(id){
// Netscape 4
if(ns4){
document.layers[id].visibility = "show";
}
// Explorer 4
else if(ie4){
document.all[id].style.visibility = "visible";
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 ¦¦ ns6){
document.getElementById(id).style.visibility = "visible";
}
}
function hide(id){
// Netscape 4
if(ns4){
document.layers[id].visibility = "hide";
}
// Explorer 4
else if(ie4){
document.all[id].style.visibility = "hidden";
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 ¦¦ ns6){
document.getElementById(id).style.visibility = "hidden";
}
}
//-->
</script>