View Full Version : simple mootools accordion with hover effect

05-29-2009, 01:46 PM
Hi all,
I'm trying to customize the mootools accordion demo (http://demos.mootools.net/Accordion). I'm trying to add a mouseover effect on the togglers. I'd like them to change their background color on mouse over. Could you help me a little?

This is the javascript code:

window.addEvent('domready', function() {

//create our Accordion instance
var myAccordion = new Accordion($('accordion'), 'div.toggler', 'div.element', {
opacity: false,
onActive: function(toggler, element){
toggler.setStyle('color', '#41464D');
onBackground: function(toggler, element){
toggler.setStyle('color', '#528CE0');

I tried to add something like:

$('div.toggler').addEvent('mouseover', function(){
toggler.setStyle('background-color', '#000000');
but didn't work