Results 1 to 7 of 7

Thread: Dropdown help

  1. #1
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dropdown help

    I have a dropdown. It's a basic dropdown. But I want to add an expansion on to it. So, could you help me?

    My code is this.

    index.php

    <a href="#"><img src="images/home.gif" alt="Home" border="0" /></a>
    <a href="#"><img src="images/jokes.gif" alt="Jokes" border="0" id="menu_parent" style="margin-left: 8px;" /></a>
    <a href="#"><img src="images/faq.gif" border="0" style="margin-left: 8px;" alt="FAQ" /></a>
    <a href="#"><img src="images/links.gif" border="0" style="margin-left: 8px;" alt="Links" /></a>
    <div id="menu_child"><a href="#">Fat momma</a><a href="#">Ugly momma</a><a href="#">stupid momma</a></div>
    <script type="text/javascript">
    at_attach("menu_parent", "menu_child", "hover", "y", "pointer");
    </script>

    Js.php

    // <script>




    // ----- Popup Control ---------------------------------------------------------

    function at_display(x)
    {
    win = window.open();
    for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
    }

    // ----- Show Aux -----

    function at_show_aux(parent, child)
    {
    var p = document.getElementById(parent);
    var c = document.getElementById(child);

    var top = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
    var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

    for (; p; p = p.offsetParent)
    {
    top += p.offsetTop;
    left += p.offsetLeft;
    }

    c.style.position = "absolute";
    c.style.top = top +'px';
    c.style.left = left+'px';
    c.style.visibility = "visible";
    }

    // ----- Show -----

    function at_show()
    {
    p = document.getElementById(this["at_parent"]);
    c = document.getElementById(this["at_child" ]);

    at_show_aux(p.id, c.id);

    clearTimeout(c["at_timeout"]);
    }

    // ----- Hide -----

    function at_hide()
    {
    c = document.getElementById(this["at_child"]);

    c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
    }

    // ----- Click -----

    function at_click()
    {
    p = document.getElementById(this["at_parent"]);
    c = document.getElementById(this["at_child" ]);

    if (c.style.visibility != "visible") at_show_aux(p.id, c.id);
    else c.style.visibility = "hidden";

    return false;
    }

    // ----- Attach -----

    // PARAMETERS:
    // parent - id of visible html element
    // child - id of invisible html element that will be dropdowned
    // showtype - "click" = you should click the parent to show/hide the child
    // "hover" = you should place the mouse over the parent to show
    // the child
    // position - "x" = the child is displayed to the right of the parent
    // "y" = the child is displayed below the parent
    // cursor - Omit to use default cursor or check any CSS manual for possible
    // values of this field

    function at_attach(parent, child, showtype, position, cursor)
    {
    p = document.getElementById(parent);
    c = document.getElementById(child);

    p["at_parent"] = p.id;
    c["at_parent"] = p.id;
    p["at_child"] = c.id;
    c["at_child"] = c.id;
    p["at_position"] = position;
    c["at_position"] = position;

    c.style.position = "absolute";
    c.style.visibility = "hidden";

    if (cursor != undefined) p.style.cursor = cursor;

    switch (showtype)
    {
    case "click":
    p.onclick = at_click;
    p.onmouseout = at_hide;
    c.onmouseover = at_show;
    c.onmouseout = at_hide;
    break;
    case "hover":
    p.onmouseover = at_show;
    p.onmouseout = at_hide;
    c.onmouseover = at_show;
    c.onmouseout = at_hide;
    break;
    }
    }


    Thanks.

  2. #2
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Anyone?

  3. #3
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you don't understand. Like this.

    [Item 1] [Item 2] [Item 3] [etc..]
    [Drop 1]
    [Drop 2] -> [Expansion 1]
    [Drop 3] [Expansion 2]
    [Expansion 3]

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    But I want to add an expansion on to it
    What do you mean by expansion.
    - Mike

  5. #5
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ...
    [Item 1] [Item 2] [Item 3] [etc..]
    [Drop 1]
    [Drop 2] -> [Expansion 1]
    [Drop 3] [Expansion 2]
    [Expansion 3]

  6. #6
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    If you could show what the code above does in a live demo we will be able to help better.

  7. #7
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi!

    I've downloaded this script too, but I have a problem.
    I want to make a menu system, but I can't create more than one main menu.
    Can you help me, what I should do?
    http://img.photobucket.com/albums/v6...opdown_scr.jpg

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
  •