Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2009, 02:48 PM   PM User | #1
InCiTe
New to the CF scene

 
Join Date: Oct 2008
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
InCiTe is an unknown quantity at this point
Question Mootools - transition: Fx.Transitions.quadIn - Close divs.

Hi guys im having some problems with the code below. Here is the JS:

Code:
		var Site = {
	
			start: function(){
				if($('accordion')) Site.accordion();
			},
			
			accordion: function(){
				var list = $$('#accordion li div.collapse');
				var headings = $$('#accordion li h1');
				var collapsibles = new Array();
				var spans = new Array();
				
				headings.each( function(heading, i) {

					var collapsible = new Fx.Slide(list[i], { 
						duration: 500, 
						transition: Fx.Transitions.quadIn
					});
					
					collapsibles[i] = collapsible;
					if (Cookie.get("menu_"+i)) {
					collapsible.show();
					}
					else {
					collapsible.hide();
					}
					heading.onclick = function(){
					var span = $E('span', heading);
					if(span){
					var newHTML = span.innerHTML == '+' ? '-' : '+';
					span.setHTML(newHTML);
					}
					if (Cookie.get("menu_"+i)) {
					Cookie.remove("menu_"+i);
					}
					else {
					Cookie.set("menu_"+i, true);
					}
					collapsible.toggle();
					return false;
					}
					//collapsible.hide();
					
				});
			}
		};
		window.addEvent('domready', Site.start);
You can view the live site here: http://www.zeroformat.com
If you navigate through the first two buttons of the menu you will notice that the menu items slide down as they should. However before I entered the cookie scripting there was only one item open at a time. I have lost the functionality to close the other expanding div once a seperate one is clicked.

Clarification:
Design and Photos are not selected and therefore the sub menus are not shown. Say you clicked design it would then expand with the sub menus. Then if you clicked photos this should minimize the design submenu whilst opening the photos sub menu.

My cookie code is so that the open menu at the time is remembered and automatically expanded on page reload.

Am i missing something here?

Really really appreciate any help from you guys your the real hero's of the world!
InCiTe is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:13 AM.


Advertisement
Log in to turn off these ads.