Click to See Complete Forum and Search --> : Should I use absolute positioning sparingly?


Ark86
09-26-2001, 09:50 PM
I am building my new website and I am going to use the "dyanamic" menu system. I was only thinking of using one level of options. But anyways, what is the best ways to position the first layer on screen (the one that starts out hidden, and when you roll the mouse over the main topic, it appears). Should I use position:absolute in my style sheet or is there another way to do it? How is it usually done? Also, if anyone can give me some tips for writing the JavaScript for it I would appreciate it.

------------------
My new computer:

Celeron 700 mhz
Sound Blaster Live! Built into MB
"Blaster" motherboard (this is actually a pretty decent mb)
128mb pc100 ram
REALLY cool case with FM radio built in and all of your USB, spdif ports right in front
Radeon LE video card

Grizzly
09-26-2001, 10:32 PM
Yeah, absolute positioning is how I've always done it.

One thing to keep in mind when writing the JavaScript: Remember that Netscape and IE refer to layers very differently in their respective JavaScript DOM's. They both also refer to the "hidden" and "visible" attributes very differently in their DOM's.

I wrote a pretty simple, but effective "ShowHide" function which supports both IE and Netscape. When I dig it up I'll be glad to post it for you.

kid A
09-27-2001, 04:19 AM
I'd be interested in that function too http://www.sharkyforums.com/ubb/smile.gif

------------------
Now listening to:
Kaizers Orchestra - Ompa Til Du Dør

Grizzly
09-27-2001, 08:24 AM
Cool, I'll post it later today. I think I left it on my computer at work.

It beats the hell out of that crappy one DreamWeaver generates. The "MM_ShowHide" function is just waaay too much of a pain to manage and use, if you ever try to change code yourself.

My function is easy piesy http://www.sharkyforums.com/ubb/biggrin.gif I should have it posted here sometime this evening.

kid A
09-27-2001, 11:48 AM
Originally posted by Grizzly:
Cool, I'll post it later today. I think I left it on my computer at work.

It beats the hell out of that crappy one DreamWeaver generates. The "MM_ShowHide" function is just waaay too much of a pain to manage and use, if you ever try to change code yourself.

My function is easy piesy http://www.sharkyforums.com/ubb/biggrin.gif I should have it posted here sometime this evening.

MM_showHide LOL. I've used that one quite a bit.

------------------
Now listening to:
Kaizers Orchestra - Ompa Til Du Dør

Grizzly
09-27-2001, 04:19 PM
Alright, here's the stuff:


function getLayer(name)
{
if (document.all){
return document.all[name].style;
}else if (document.layers){
return document.layers[name];
}else return false;
}


function showHide(){

var args = showHide.arguments;
ShowLayerName = args[0];

x = getLayer(ShowLayerName);
x.visibility = 'visible';

for (i=1; i<args.length; i++){
HideLayerName = args[i];
y = getLayer(HideLayerName);
y.visibility = 'hidden';
}


}


Basically....those are two functions. How do you use them to ShowHide layers you ask? Well it's easy!

Just say:

showHide('ShowMe', 'HideMe1', 'HideMe2', 'HideMe3', 'HideMe4', 'HideMe5')

etc etc etc.

In english, showHide() will take an infinite number of parameters. The FIRST parameter you pass it should be the layer you want set to "visible." Every subsequent parameter passed to it, should be a layer which you want hidden.

If you have any questions about it lemme know. It works on all 4.0+ browsers (Netscape included!)


[This message has been edited by Grizzly (edited September 27, 2001).]

Ark86
09-27-2001, 07:10 PM
OK, thanks a lot. Answered all of my questions http://www.sharkyforums.com/ubb/smile.gif

------------------
My new computer:

Celeron 700 mhz
Sound Blaster Live! Built into MB
"Blaster" motherboard (this is actually a pretty decent mb)
128mb pc100 ram
REALLY cool case with FM radio built in and all of your USB, spdif ports right in front
Radeon LE video card

Grizzly
09-27-2001, 08:07 PM
Originally posted by kid A:
MM_showHide LOL. I've used that one quite a bit.



Yeah it's a real piece of work! Ugh, I hate all MM JavaScript...it's sooooo bulky.

Here's an example of someone using MM_ShowHide on a site I worked on once:

MM_showHideLayers('clearPers1', '','hide','clearPers2', '','show','clearPers3', '','hide','clearPers4','','hide','personal','','hide','conta ct', '','show','professional','', 'hide','cor porate','','hide','blueline','', 'show','persON','','hide','persROLL','','show','contROLL','' ,'hide','contON','','show','proROLL','','show', 'proON','','hide','corpROLL', '','show','c oprON','', 'hide')


It's just hideous...heinous...outrageous!



[This message has been edited by Grizzly (edited September 27, 2001).]

Ark86
09-27-2001, 08:40 PM
Talk about confusing!

------------------
My new computer:

Celeron 700 mhz
Sound Blaster Live! Built into MB
"Blaster" motherboard (this is actually a pretty decent mb)
128mb pc100 ram
REALLY cool case with FM radio built in and all of your USB, spdif ports right in front
Radeon LE video card

kid A
09-28-2001, 09:56 AM
Thanks for the code, Grizzly. http://www.sharkyforums.com/ubb/smile.gif

I'll have a go at trying it out today if I find the time.

------------------
Now listening to:
Kaizers Orchestra - Ompa Til Du Dør