Journey into MooTools: Day 4

Journey into MooTools: Day 4

By Jack Franklin on October 30th, 2009 in Tutorials

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.

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');
				}
			}); */

		});
Did you like it? Share it!
  • Delicious
  • DesignBump
  • DesignFloat
  • Digg
  • Facebook
  • StumbleUpon
  • Technorati
  • Twitter
About The Author
Jack Franklin

Jack is a 18 year old web designer and developer who lives in the beautiful area of Cornwall, England. Off the computer, Jack enjoys playing snooker, tennis, football and badminton.

Comments
No comments yet... Be the first to drop a line or two!
Trackbacks

Toggle Trackbacks

  1. [... 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. ...]

So, what do you think?

x