Expanding All Menu Sections

rickyhawtin / 2011-09-03 04:40:26   

I'm currently using Ross Cairns script on my site here:
Link

But instead of Expanding the menu's one at a time, i want to expand all of them
at once. (Like the menu on this website)

  1. Here is my .js
  2. /*Expanding Menus for Indexhibit
  3. *uses jquery
  4. *
  5. *Created by Ross Cairns Mar 2008
  6. */
  7. function expandingMenu(num) {
  8. var speed = 300;

var item_title = $("#menu ul").eq(num).children(":first");
var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });

/* hide items if not active */
if (items.is(".active") == true) {
items.hide();
}

/* hide items if not active */
if (items.is(".active") == false) {
items.hide();
}

/* add click functions + pointer to title */
item_title.css({cursor:"pointer"}).toggle(
function () {
items.show(speed);
}, function () {
items.hide(speed);
}
)
}

  1. - And here is my index.php from my theme:
  2. path = '/files/gimgs/';
  3. $(document).ready(function()
  4. {
  5. setTimeout('move_up()', 1);
  6. expandingMenu(0);
  7. expandingMenu(1); 
  8. expandingMenu(2);
  9. expandingMenu(3);
  10. expandingMenu(4);
  11. expandingMenu(5);
  12. expandingMenu(6);
  13. });

Can somebody help me with this?

Thanks guys!

rickyhawtin / 2011-09-03 19:15:09   

Anybody?

rickyhawtin / 2011-09-05 17:45:57   

Solved!

kenny / 2011-10-03 07:23:57   

Hi Ricky, I have expanding menus by following Ross Cairns example here, but i wonder how you did solve the problem, im searching for the answer to make all of my menus to expand at the same time. If you can help me i would be delighted! / Kenny

rickyhawtin / 2011-10-03 08:55:09   

A dear friend of mine fixed it in the expandingMenu.js

Just paste the following:

/*    Expanding Menus for Indexhibit
*        uses jquery
*
*    Created by Ross Cairns Mar 2008
*/

function expandingMenu(num) {
    var speed = 300;
    
    var item_title = $("#menu ul").eq(num).children(":first");
    var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });
    var items1 = $("#menu ul").eq(1).children().filter(function (index) { return index > 0; });
    var items2 = $("#menu ul").eq(2).children().filter(function (index) { return index > 0; });
    var items3 = $("#menu ul").eq(3).children().filter(function (index) { return index > 0; });
    var items0 = $("#menu ul").eq(0).children().filter(function (index) { return index > 0; });

    /* hide items if not active */
    if (items.is(".active") == true) {
        items.hide();
    }

    /* hide items if not active */
    if (items.is(".active") == false) {
        items.hide();
    }
    
    /* add click functions + pointer to title */
    item_title.css({cursor:"pointer"}).toggle(
        function () {
            items.show(speed);
            items1.show(speed);
            items2.show(speed);
            items3.show(speed);
            items0.show(speed);
        }, function () {
            items.hide(speed);
            items1.hide(speed);
            items2.hide(speed);
            items3.hide(speed);
            items0.hide(speed);

        }
    )
}

kenny / 2011-10-03 12:49:24   

Many thanks! It worked great! :)

This thread has been closed, thank you.