Cufon - problem with hover effects and active menu items

zekia picture zekia · Feb 21, 2011 · Viewed 16.8k times · Source

I have created a menu using cufon fonts.

I decided to apply the following styles on menu items:

  • normal : grey color text
  • hover : black color text
  • active : red color text

The problem is that hovering the (red) active menu item, has as a result to turn it back to grey color (and make it look like any other "normal" menu item). I don't understand why, can you help me fix it?

Here is the current cufon configuration:

Cufon.replace('ul#mainmenu li > a', {
    color: '#868686',
    fontFamily: 'pfbeau',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
    hover: {
        color: '#3e3e3e'
    }
});
Cufon.replace('ul#mainmenu li.active > a', {
    color: '#af1217',
    fontFamily: 'pfbeau',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
    hover: false
});

Answer

Alex picture Alex · Feb 21, 2011

CRACKED IT MATE!

Cufon('ul#mainmenu li.active a', {
hover: { color: '#3e3e3e'},
    color: '#af1217',
    fontFamily: 'BlackBeard',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
});

Cufon('ul#mainmenu li a', {
    hover: { color: '#3e3e3e'},
    color: '#868686',
    fontFamily: 'BlackBeard',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
});

Cufon.replace('ul#mainmenu li', {
    color: '#868686',
    fontFamily: 'BlackBeard',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
});

Cufon.replace('ul#mainmenu li.active a', {
    color: '#af1217',
    fontFamily: 'BlackBeard',
    fontSize: '15px',
    textShadow: '0 2px 0.1em #fff',
});    

Check it out! - http://jsfiddle.net/3Yf4G/2/

Replace the font 'BlackBeard' with yours...