hi everyone,
i just added a hover effect to my expanding menu and thought some of you might be interested in the code i used. preview
best
christian
/*Expanding Menus for Indexhibit
*uses jquery
*
*Created by Ross Cairns Mar 2008
*
* Revised by Christian Moser Jul 2009
*
*/
function expandingMenu(num) {
var speed = 500;
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(
/* on hover */
function () {
$(this).css({ "background-color":"#afe1b1", "color": "#373737"});
},
/* after hover return to */
function () {
var cssObj = { "background-color": "#373737", "color": "#fff"}
$(this).css(cssObj);
})
item_title.css({cursor:"pointer"}).toggle(
function () {
items.show(speed);
}, function () {
items.hide(speed);
}
)
}