Iam下面有JQuery代码用于菜单手风琴。实际上这个代码适用于静态dats,但是在动态数据的情况下无法正确生成输出..在我的情况下,我的代码生成ul,li,锚标签自动生成,所以输出不正确..
那么,任何人都可以告诉我如何使其适用于动态数据..?
以下是代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<title>jQuery Vertical Accordion Menu Plugin v 2.6</title>
<link href="css/dcaccordion.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.cookie.js'></script>
<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcjqaccordion.2.7.min.js'></script>
<script type="text/javascript">
$(document).ready(function($){
$('.accordion-6').dcAccordion({
eventType: 'hover',
autoClose: true,
saveState: true,
disableLink: true,
menuClose: false,
speed: 'medium',
showCount: true,
autoExpand: true,
cookie : 'dcjq-accordion-1',
classExpand : 'dcjq-current-parent',
menuClose: false
});
});
</script>
<link href="css/skins/blue.css" rel="stylesheet" type="text/css" />
<link href="css/skins/graphite.css" rel="stylesheet" type="text/css" />
<link href="css/skins/grey.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrap">
<div class="graphite demo-container">
<ul class="accordion accordion-6">
<li><a href="#">Home</a></li>
<li><a href="#">Products</a>
<ul class="accordion" id="accordion-6">
<li><a href="#">Mobile Phones & Accessories</a> </li>
<li><a href="#">Desktop</a> </li>
</ul>
</li>
<li><a href="#">About Us</a>
<ul class="accordion" id="accordion-6">
<li><a href="#">About Page 1</a></li>
<li><a href="#">About Page 2</a></li>
</ul>
</li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</div>
</div>
</body>
</html>
BTW,从这里我得到了这段代码:
http://www.designchemical.com/lab/jquery-vertical-accordion-menu-plugin/download/
希望有人能为我的问题提供解决方案..
谢谢!