Menu - Auto expand one at a time.

puppiepoppy / 2010-01-24 07:18:52   

I've successfully created an automatic menu where the headers expand automatically onmouseover. The site looks ok, however I would like to further modify it but kept hitting a brick wall! Ooucch!

I would like only one header to be expanded at any one time. When the mouse is out and move over to another header, the previous header will collapse on its own.

My current expandingMenu.js as below:


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

function expandingMenu(num) {

var speed = 200;

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") == false) {
items.hide();
}

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

}

arsondpi / 2010-01-24 10:51:03   

did you search for the nine script?

puppiepoppy / 2010-01-24 14:35:26   

I just search the 'nine' script but i seems I will also need to upgrade to the latest Jquery and this will screw up some of my slideshow pages as well. Hmmmmn.

Any other way to get around this?

arsondpi / 2010-01-24 18:37:47   

not to my knowledge.

ivovaladares / 2010-01-26 23:44:57   

/*    Autor: The nine
    www.elarcadenoe.es
*/

$(document).ready(function()
{
    // Ocultar todos
    $("#menu ul li.section-title").nextAll().hide();
    
    //mostrar activo
    $("#menu ul").each(function(){
    $(this).find("li.active").prevAll().nextAll().show();
    });
    
    //Expandir y ocultar
$("#menu ul li.section-title").click(function(){
$("#menu ul li.section-title").nextAll().hide();
$(this).nextAll().slideToggle("fast");
});
});

This last one what does is to close other open section when you select a new one: Webpage.
Far from beeing finished but

puppiepoppy / 2010-03-01 18:42:00   

Coool, finally I've managed to create the 'auto expand at any one time'. However, I don't think it's THENINE script.

The link is here.

Also, using the same script, I've managed to hide multiple quicktime files into one single page, and when any one of the link is clicked, the particular quicktime file will expands. Just nice! Click here.

This thread has been closed, thank you.