1

我在下面有用于菜单手风琴的 JQuery 代码。实际上这段代码非常适用于静态数据,但在动态数据的情况下无法正确生成输出。在我的情况下,我的代码生成 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 &#038; 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>

顺便说一句,从这里我得到了这个代码:

http://www.designchemical.com/lab/jquery-vertical-accordion-menu-plugin/download/

希望有人能为我的问题提供解决方案..

谢谢!

4

0 回答 0