
Journey into MooTools: Day 4
Today we’ll look at making an accordion in Mootools, firstly using techniques we’ve already learnt and secondly using MooTool’s own Accordion function.
By Jack Franklin on October 30th, 2009 in Tutorials | 
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');
}
}); */
});
Similar Posts
Want more web design and development tips?
Subscribe to The Web Squeeze by Email, or our RSS feed, and you'll have all the latest web design tips coming right to your inbox! Don't be a stranger, join our forum!







Comments
Toggle Trackbacks
Trackbacks
Do you have something to say?