当我单击顶部菜单中的链接时,我无法正确打开 jquery 手风琴侧菜单。对不起,我切换了我的代码。这是我的页面:
这是我的侧导航 JS:
function initMenu() {
$('#nav ul').hide();
/*$('#nav ul:first').show();*/
$('#nav li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
return true;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#nav ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});
我的侧导航 UL LIST
<ul id="nav">
<li><a href="#">Item 1</a>
<ul>
<li><a href="#">test1</a></li>
<li><a href="#">test2</a></li>
<li><a href="#">test3</a></li>
</ul>
</li>
<li><a href="#">Item 2</a>
<ul>
<li><a href="#">Sub-Item 2 a</a></li>
<li><a href="#">Sub-Item 2 b</a></li>
</ul>
</li>
<li><a href="#">Item 3</a>
<ul>
<li><a href="#">Sub-Item 3 a</a></li>
<li><a href="test1.shtml">Sub-Item 3 b</a></li>
<li><a href="#">Sub-Item 3 c</a></li>
<li><a href="#">Sub-Item 3 d</a></li>
</ul>
</li>
<li><a href="#">Item 4</a>
<ul>
<li><a href="#">Sub-Item 4 a</a></li>
<li><a href="#">Sub-Item 4 b</a></li>
<li><a href="#">Sub-Item 4 c</a></li>
</ul>
</li>
</ul>
我要激活的页面
<script type='text/javascript'>
google.load('search', '1', {language: 'en', style: google.loader.themes.V2_DEFAULT});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
customSearchOptions['overlayResults'] = true;
var customSearchControl = new google.search.CustomSearchControl('008189712368144530774:cd8hgx1d4hk', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
customSearchControl.draw('cse', options);
}, true);
</head>
<body>
<div id="container">
<div id="topbox">
<div id="topnav"><!--#include file="topnav.html" --></div>
<div id='cse'>Loading</div>
</div>
<div id="leftcol">
<div id="Topleft"><!--#include file="topleftphoto.html" --></div>
<div id="SideNav"><!--#include file="sidenavdistrict.html" --></div>
</div>
<div id="rightcol">
<div id="TopRight">Content for id "topright" Goes Here</div>
<div id="Body">Content for id "body" Goes Here</div>
</div>
<div id="Footer">Content for id "footer" Goes Here</div>
</div>
关于如何解决这个问题的任何想法都会很棒。我只是在学习如何使用它,所以如果你有帮助,请具体说明应该去哪里。您可以在 www.rsd17.org/test/test/untitled1.shtml 查看实时网站 谢谢