Should I use absolute positioning sparingly?

Sharky Forums


Results 1 to 10 of 10

Thread: Should I use absolute positioning sparingly?

  1. #1
    Tiger Shark Ark86's Avatar
    Join Date
    Aug 2001
    Location
    Ohio
    Posts
    924

    Question Should I use absolute positioning sparingly?

    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
    My Webpage: http://www.andyknotts.com (Give me feedback)

    My specs:
    ----------------
    AMD Athlon XP 2500+ OC'd to 2100MHz
    Abit NF7 @ 205 MHz FSB
    1.5Gigs PC3200 RAM @410Mhz
    Turtle Beach Santa Cruz
    Altec Lansing 641's
    128meg NVidia 6600GT AGP
    7200rpm 120G w/ WinXP pro
    5400rpm 40G w/ Gentoo Linux
    NEC DVD/RW
    Lite-on 40x12x48 CDRW
    19" Hyundai L90D+ LCD (amazing )

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    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.

  3. #3
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    I'd be interested in that function too

    ------------------
    Now listening to:
    Kaizers Orchestra - Ompa Til Du Dør
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  4. #4
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    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 I should have it posted here sometime this evening.

  5. #5
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    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 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
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  6. #6
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Alright, here's the stuff:

    Code:
    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).]

  7. #7
    Tiger Shark Ark86's Avatar
    Join Date
    Aug 2001
    Location
    Ohio
    Posts
    924

    Post

    OK, thanks a lot. Answered all of my questions

    ------------------
    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
    My Webpage: http://www.andyknotts.com (Give me feedback)

    My specs:
    ----------------
    AMD Athlon XP 2500+ OC'd to 2100MHz
    Abit NF7 @ 205 MHz FSB
    1.5Gigs PC3200 RAM @410Mhz
    Turtle Beach Santa Cruz
    Altec Lansing 641's
    128meg NVidia 6600GT AGP
    7200rpm 120G w/ WinXP pro
    5400rpm 40G w/ Gentoo Linux
    NEC DVD/RW
    Lite-on 40x12x48 CDRW
    19" Hyundai L90D+ LCD (amazing )

  8. #8
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    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).]

  9. #9
    Tiger Shark Ark86's Avatar
    Join Date
    Aug 2001
    Location
    Ohio
    Posts
    924

    Post

    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
    My Webpage: http://www.andyknotts.com (Give me feedback)

    My specs:
    ----------------
    AMD Athlon XP 2500+ OC'd to 2100MHz
    Abit NF7 @ 205 MHz FSB
    1.5Gigs PC3200 RAM @410Mhz
    Turtle Beach Santa Cruz
    Altec Lansing 641's
    128meg NVidia 6600GT AGP
    7200rpm 120G w/ WinXP pro
    5400rpm 40G w/ Gentoo Linux
    NEC DVD/RW
    Lite-on 40x12x48 CDRW
    19" Hyundai L90D+ LCD (amazing )

  10. #10
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    Thanks for the code, Grizzly.

    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
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •