expanding menu / hover effect

cmdesigns / 2009-07-16 17:17:36   

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

  1. /*Expanding Menus for Indexhibit
  2.  *uses jquery
  3.  *
  4.  *Created by Ross Cairns  Mar 2008
  5.  *
  6.  *  Revised by Christian Moser Jul 2009
  7.  *
  8. */

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);
}
)
}

Vaska A / 2009-07-16 18:49:04   

No hover effect seen.

Vaska A / 2009-07-17 11:07:04   

Closing this thread...this code does not work. It is not advised you try it.

(The reason that I pulled my own edited version of this code in the past was because it required a newer versions of Jquery. The problem was that if you upgraded to new Jquery some exhibition formats will break so it made more sense for me to wait on a new version for everything. This code, might work (although I am not debugging this), with a new version of Jquery but some current exhbition formats will definitely break).

This thread has been closed, thank you.