Collapsing a Div?

liunx

Guest
Meh, Im not quite sure if this is the right forum, but lets check shall we? :)

Alright, i have a navigation bar, and i was wondering if i could like minimize it or close? So it is out of view, then when you click on it, it appears...im not sure if that makes sense...does it? :SYou may try looking for either JavaScript or DHTML im not entirely which would do it.Or flash i suppose could do it but not an entirely good accessibility idea though.I dont think i want to go the flash route...Yeh probably not the best idea but just a suggestion incase you had some flash skills.You could use a Javascript onclick handler to change the style of the containing div between display:block and display:none. If you default to the former then set the latter in a page onload, the menu would be there for non-Javascript folks.as ray alluded to, I use:

var mydiv = document.getElementById("bob");
mydiv.style.visibility = "visible";
mydiv.style.display = "inline";

to show a div and:

var mydiv = document.getElementById("bob");
mydiv.style.visibility = "hidden";
mydiv.style.display = "none";

to hide the div. This is javascript. I believe that getElementById only works in IE. You can set a css class for your div and one of the elements to set up the class is the visibility and display elements (many times I want my div to initialize hidden so I do this in the class itself).I believe that getElementById only works in IE. It's part of the DOM so it works in real browsers, too.That's good to know. My customer only uses IE, so I'm spoiled to not have to write for multiple browsers. But at the same time, it bites me sometimes when giving advice. Thanks!
 
Back
Top