Menu demo

This simple demo shows how easy it is to set up some very effective menu animation.

var menu = document.getElementById('menu'),
    links = menu.getElementsByTagName('a'),
    myMorph = new jsMorph(links,
      {height: '35px', 'border-bottom-width' : '18px', 'border-top-width' : '10px',
        'margin-bottom' : '-18px', 'margin-top' : '-10px', 'padding-top' : '24px'},
      {duration : 300},
      function(n) {return --n*n*n*n*n+1}
    );

menu.onmouseout = menu.onmouseover = function(e) { // event delegation
  var e = e || window.event,
      obj = e.target || e.srcElement;
      
  if (obj.tagName.toLowerCase() == 'a') {
    obj.backwards = (e.type == 'mouseout') ? true : false;
    myMorph.start(obj);
  }
}