WEB Need help with collapse/expand menu

Discussion in 'OT Technology' started by cdoyle, Sep 29, 2008.

  1. cdoyle

    cdoyle I finally changed this!

    Joined:
    Aug 5, 2001
    Messages:
    1,233
    Likes Received:
    0
    Hi,

    Hopefully someone can help with this, I've been searching and searching and just can't find what I'm looking for.

    I have a left div on my page that is 160px, what I would like to place in this area is the menu.

    I would like to have a menu that is collapsible/expandable.
    I found this

    http://javascript.internet.com/navigation/click-to-expand-menu.html

    Which is close to what I need, but what I found is because it uses lists, it pushes everything over, so the menu items don't have much room at all. I've tried messing with the margins/padding of the LI but it doesn't seem to work.

    I would also like to be able to have one of the menu items be auto expanded when the page opens, but not sure how to do that.

    Does anyone know how to tweak this script, or know of a better one?

    Thanks!

    Does anyone know how to tweak this to
     
  2. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    you could add "left:-20px;position:relative;" to the li and it should push it back over
     
  3. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
  4. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
  5. Pepsi1975

    Pepsi1975 Mod of the Year

    Joined:
    Jan 6, 2005
    Messages:
    47,590
    Likes Received:
    1
    Location:
    Detroit
  6. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    :rofl:

    jQuery is actually integrated with Drupal. :x:
     
  7. Pepsi1975

    Pepsi1975 Mod of the Year

    Joined:
    Jan 6, 2005
    Messages:
    47,590
    Likes Received:
    1
    Location:
    Detroit
    i am just pulling your leg :rofl:
     
  8. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    Microsoft is going to package jQuery with Visual Studio with full IDE integration, and it will be part of all ASP.NET MVC projects.

    They will also be giving it official product support too.
     
  9. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,489
    Likes Received:
    70
    Location:
    Sparkopolis
    IB everyone starts hating on jQuery
     
  10. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    Maybe they'll make an effort now to get rid of the horrid inline JavaScript. Now that they're promoting jQuery which would be good DOM practice.
     
  11. pkr

    pkr Guest

    You're actually integrated with Drupal.
     
  12. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    I actually had to do collapsible menus with one of the projects I'm currently working on. Here's the script so you don't have to deal with that. Just download the jQuery framework and modify the selector if necessary.

    Code:
    $("ul li:has(ul)").click(function(event) {
      if (this == event.target) {
        $(this).children().is(":hidden") ? $(this).css('background-image', 'url(images/arrow_d.gif)') : $(this).css('background-image', 'url(images/arrow_r.gif)');
        $(this).children().toggle();
      }
      return false;			
    });
    
     
  13. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    you and your fucking li:has(ul)
     
  14. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    ul#rofl li:not(ul:has(ul > li.broseph a));
     
  15. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    help me with some soap + wsdl shit :wtc:
     
  16. Pepsi1975

    Pepsi1975 Mod of the Year

    Joined:
    Jan 6, 2005
    Messages:
    47,590
    Likes Received:
    1
    Location:
    Detroit
    you do not question King Toad, it has already been established he is the Internet, question him and tomorrow all your traffic will dry up and you will be kicked off the server that hosts the dry barren site that was once your bread and butter
     
  17. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    :rofl:
     
  18. Pepsi1975

    Pepsi1975 Mod of the Year

    Joined:
    Jan 6, 2005
    Messages:
    47,590
    Likes Received:
    1
    Location:
    Detroit
    see what happens when this forum is slow :rofl:
     

Share This Page