Results 1 to 8 of 8

Thread: Drop Down panel

  1. #1
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Drop Down panel

    I found this very simple Drop Down Panel at javascript kit.
    I've implemented it on this test page:
    www.threefooter.com/dropdown

    It works perfectly, and is very simple to build the dropdown page with all the elements I need... but I want to limit the width to 965 px.

    Any ideas on how to it?

    Thanks,

    Lasa2

  2. #2
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    I got it... the minute I saw the question on the page it made sense..
    width: 965px; instead or 100%;

    Was looking for something more complicated!

    Thanks for all the help you guys have been giving me...

    Lasa2

  3. #3
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    Is there a way to have the drop down panel "always on top"... it opens below object even if placed on a layer above?
    www.threefooter.com/dropdown

  4. #4
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    I was able to fix the always on top with a z-index:4

    The site is 965 px wide... the page in theory is set up to be centered.
    The light blue panel is centered but the Drop Down panel remains left...
    I've played with the left:0 ( I've changed it to every % I could think of and px ) no luck

    #dropdownpanel{ /*Outermost Panel DIV*/
    position: absolute;
    width: 965px;
    left: 0;
    top: 0;
    visibility:hidden;
    z-index:4;


    Lasa2

  5. #5
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Try this instead:
    Code:
    #dropdownpanel {
    left:50%;
    margin-left:-483px;
    position:absolute;
    top:0;
    visibility:hidden;
    width:966px;
    z-index:4;
    }
    I also suggest you change 965px to 966px all the other places because that will be easier to center

  6. #6
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    azoomer... that's it! You guys are great!

    Could you explain the reasoning behind it?
    I'm trying to understand it... let's see.
    483px is half of the 966px.
    If we set the left margin to -486 then, left 50% ...

    I got nothing...lol

    Lasa2

  7. #7
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    when an element has position relative and has a width you can center it with
    Code:
    margin-left: auto;
    margin-right:auto;
    If it has position absolute you need to use
    Code:
    left:50%;
    margin-left: - (width/2)px;
    I can't explain it better but these two ways of doing it will usually work fine.

  8. #8
    Join Date
    Aug 2010
    Posts
    45
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    Thanks again... I'll save the tip.
    Lasa2

Bookmarks

Posting Permissions

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