Today we will actually make something half useful, first using the techniques we have learnt in the past 3 weeks and then using some of the extra functions MooTools provides. Enjoy!
window.addEvent('domready', function() { var headings = $$('h2'); var content = $$('p'); new Accordion(headings, content); /* content[0].getAllNext('p').setStyle('display', 'none'); headings.addEvent('click', function() { var currentp = this.getNext(); if(currentp.getStyle('display') == 'none') { currentp.setStyle('display', 'block'); currentp.getAllPrevious('p').setStyle('display', 'none'); currentp.getAllNext('p').setStyle('display', 'none'); } else { //need to hide currentp.setStyle('display', 'none'); } }); */ });