• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 613
  • Last Modified:

concertina/accordian menu

Hi,
I've found a jquery menu I'd like to used but it doesn't seem to be compatible with IE6 or IE7.
It is this one: http://www.inventpartners.com/content/jquery-concertina-menu-plugin

Do you know of any which is similiar
 - submenu's remain open until they are closed
 - maintains state from page to page.  

0
harris9999
Asked:
harris9999
  • 2
2 Solutions
 
Seo_ExpertCommented:
Hello,

Check the below url ;

http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm

I think this is what your looking for
0
 
Steve KrileCommented:
There are two different requirements here.  First, using jquery makes a menu like this trivial.  I've attached a simple example.  So, that part should be easy enough for you to roll your own.  

The second part of you request is to maintain state from page to page.  That's a bit less trivial, but doable.  

First, here is a working "clean" menu.

I'll post a method for "maintaining" state in a moment.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
	<style>

		a {
			text-decoration:none;
			padding:4px;outline:none;
		}
		a:hover {
			background:blue;color:#fff;}
		ul.menu, ul.submenu {
			padding:0;
			margin:0;
			list-style-type:none;}

		ul.menu {
			border:solid 1px gray;
			width:150px;
		}

		ul.menu li {
			padding:4px;
		}

		ul.submenu {display:none;}

		ul.submenu li {
			padding:1px;
		}


	</style>
</head>


<body>

		<ul class="menu">
			<li>
				<a href="#">Menu 1</a>
				<ul class="submenu">
					<li><a href="test.html">Go to Test Page 1</a></li>
					<li><a href="test3.html">Go To Test Page 3</a></li>
					<li><a href="#">Sub Item 3</a></li>
				</ul>
			</li>
			<li>
				<a href="#">Menu 2</a>
				<ul class="submenu">
					<li><a href="#">Sub Item 1</a></li>
					<li><a href="test2.html">Go To Test Page 2</a></li>
					<li><a href="#">Sub Item 3</a></li>
				</ul>
			</li>
		</ul>

	<script type="text/javascript">
	$(document).ready(function(){
		$("ul.menu > li > a:first-child").click(function(e){
			e.preventDefault();
			$(this).next().slideToggle();
		});
	 });
	</script>




</body>
</html>

Open in new window

0
 
Steve KrileCommented:
Here is a collection of three pages that illustrate keeping "state" by examining the href of a link and comparing it to the page url.  This method isn't perfect, but it works pretty good.

The code below is the trick to examining the page's current href (stripping out the http:// bits, and the path information to get at just the page name.
function getPageName() {

			var page_name_string = location.pathname.toString();
			var page_name_array = page_name_string.split('/');
			var page_name = page_name_array[page_name_array.length - 1];

		return page_name;

	 }

Open in new window

test.zip
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now