Commits

Anonymous committed f3a207f

Added main menu navigation animation.

  • Participants
  • Parent commits 1dfb111

Comments (0)

Files changed (2)

File textpattern/lib/txplib_head.php

 
 callback_event('admin_side', 'head_end');
 
-echo '</head>'.
+echo '</head>'.n.
 	 '<body id="'.$body_id.'">'.n.
 		callback_event('admin_side', 'pagetop_start').
  	 '<div id="header">'.n.
 				(has_privs('tab.content') ? 
 					n.t.t.'<li id="navtab-content" class="nav-group">'.
 						areatab(gTxt('tab_content'), 'content', 'article', $area).
-						n.t.t.t.'<ul class="sub-nav">'.
+						n.t.t.t.'<ul class="sub-nav'.menuState('content', $area).'">'.
 							tabsort('content',$event).
 						n.t.t.t.'</ul>'.
 					n.t.t.'</li>' : '').
 				(has_privs('tab.presentation') ? 
 					n.t.t.'<li id="navtab-presentation" class="nav-group">'.
 						areatab(gTxt('tab_presentation'), 'presentation', 'page', $area).
-						n.t.t.t.'<ul class="sub-nav">'.
+						n.t.t.t.'<ul class="sub-nav'.menuState('presentation', $area).'">'.
 							tabsort('presentation',$event).
 						n.t.t.t.'</ul>'.
 					n.t.t.'</li>' : '').
 				(has_privs('tab.admin') ? 
 					n.t.t.'<li id="navtab-admin" class="nav-group">'.
 						areatab(gTxt('tab_admin'), 'admin', 'admin', $area).
-						n.t.t.t.'<ul class="sub-nav">'.
+						n.t.t.t.'<ul class="sub-nav'.menuState('admin', $area).'">'.
 							tabsort('admin',$event).
 						n.t.t.t.'</ul>'.
 					n.t.t.'</li>' : '').
 				((has_privs('tab.extensions') and !empty($areas['extensions'])) ? 
 					n.t.t.'<li id="navtab-extensions" class="nav-group">'.
 						areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area).
-						n.t.t.t.'<ul class="sub-nav">'.
+						n.t.t.t.'<ul class="sub-nav'.menuState($event, $area).'">'.
 							tabsort('extensions',$event).
 						n.t.t.t.'</ul>'.
 					n.t.t.'</li>' : '').
 		callback_event('admin_side', 'pagetop_end');
 	}
 
+	function menuState($tab, $area)
+	{
+		return ' '.(($area == $tab) ? 'open' : 'closed');
+	}
 // -------------------------------------------------------------
 	function areatab($label,$event,$tarea,$area)
 	{
-		$atts = ($area == $event) ? 'open' : 'closed';
-		$hatts ='href="?event='.$tarea.'" class="nav-trigger '.$atts.'"';
+		$hatts ='href="#" class="nav-trigger"';
       	return n.t.t.t.tag($label,'a',$hatts);
 	}
 

File textpattern/textpattern.js

 	$("#date").val(currentDate);
 	$("#time").val(currentTime);
 	
+	// -------------------------------------------------------------
+	// Main Menu Accordion Animation.
 	$(".nav-trigger").click(function() {
-			$(this).next().slideToggle("fast");
+		
+			var siblings = $(this).siblings('UL');
+				if(siblings.hasClass('open')) { 
+					siblings.slideUp(150, function() { 
+							$(this).removeClass('open')
+					}); 
+				 } else {
+				 	$('.open').slideUp(150).removeClass('open');
+				 	siblings.slideDown(150, function() 
+				 		{ 
+				 			siblings.addClass('open');
+				 		});
+				 }
 	return false;
 	});