尝试将下拉菜单子页面链接到另一个页面上的选定选项卡。此处的下拉菜单:http ://arreolatran.com/clients/new_horizons/,尝试链接到此处选定的侧导航选项卡:http://arreolatran.com/clients/new_horizons/about- us.html。例如,转到关于我们下拉菜单 > 选择我们的专业知识(子页面) - 链接无效。它转到正确的页面,但没有选择正确的选项卡。下拉菜单导航代码:
<div id="nav">
<a href="index.html"><div class="nhImgs logo"></div></a>
<ul id="pages">
<li>
<a href="about-us.html">About Us<div class="nhImgs caret"></div></a>
<ul>
<li><a href="about-us.html#ourExpertise">Our Expertise</a></li>
<li><a href="about-us.html#whyChooseUs">Why Choose Us?</a></li>
<li><a href="about-us.html#tammy">Dr. Tammy Mondry</a></li>
<li><a href="about-us.html#joe">Dr. Joe Mondry</a></li>
</ul>
</li>
<li>
<a href="lymphedema.html">Lymphedema<div class="nhImgs caret"></div></a>
<ul>
<li><a href="lymphedema.html#idLymph">Identifying Lymphedema</a></li>
<li><a href="lymphedema.html#examplesLymph">Examples of Lymphedema</a></li>
<li><a href="lymphedema.html#lymphTreat">Lymphedema Treatment</a></li>
<li><a href="lymphedema.html#lymphFaqs">Lymphedema FAQs</a></li>
<li><a href="lymphedema.html#lymphProd">Products</a></li>
</ul>
</li>
<li>
<a href="cancer-rehabilitation.html">Cancer Rehabilitation<div class="nhImgs caret"></div></a>
<ul>
<li><a href="cancer-rehabilitation.html#benefitsExe">Benefits of Exercise</a></li>
<li><a href="cancer-rehabilitation.html#assessTest">Assessment and Testing</a></li>
<li><a href="cancer-rehabilitation.html#programSpec">Program Specifics</a></li>
<li><a href="cancer-rehabilitation.html#cancerExeFaqs">Cancer & Exercise FAQs</a></li>
</ul>
</li>
<li>
<a href="patient-guide.html">Patient Guide<div class="nhImgs caret"></div></a>
<ul>
<li><a href="patient-guide.html#publications">Publications</a></li>
<li><a href="patient-guide.html#downloadsForms">Downloads/Forms</a></li>
<li><a href="patient-guide.html#relatedInfo">Related Information</a></li>
</ul>
</li>
<li>
<a href="contact-us.html">Contact Us</a>
</li>
</ul>
</div>
Sidenav 选项卡代码:
<div class="sideNavCont">
<div id="sidenav">
<ul class="colL">
<li class="sidenavHdrText"><a href="#about1">About Us</a></li>
<li><a href="#expertise2">Our Expertise</a></li>
<li><a href="#why3">Why Choose Us?</a></li>
<li><a href="#tammy4">Dr. Tammy Mondry</a></li>
<li><a href="#joe5">Dr. Joe Mondry</a></li>
</ul>
<div id="about1" class="sideNavColR">
<ul>
<h1 id="aboutUs" class="pageTtl">About Us</h1>
<p>Content here.</p>
</div>
<div id="expertise2" class="sideNavColR">
<ul>
<h1 id="ourExpertise">Our Expertise</h1>
<p>Content here.</p>
</ul>
</div>
<div id="why3" class="sideNavColR">
<ul>
<h1 id="whyChooseUs">Why Choose Us</h1>
<p>Content here.</p>
</ul>
</div>
<div id="tammy4" class="sideNavColR">
<ul>
<h1 id="tammy">Dr. Tammy Mondry</h1>
<p>Content here.</p>
</ul>
</div>
<div id="joe5" class="sideNavColR">
<ul>
<h1 id="joe">Dr. Joe Mondry</h1>
<p>Content here.</p>
</ul>
</div>
</div>
</div>
用于 sidenav 选项卡的 JS:
// JavaScript Document
$(function () {
$('#sidenav div').hide();
$('#sidenav div:first').show();
$('#sidenav ul li:first').addClass('active');
$('#sidenav ul li a').click(function () {
var currentTab = $(this).attr('href');
var vis = $(currentTab).is(':visible');
$('#sidenav div').hide();
$('#sidenav ul li').removeClass('active');
$(this).parent().addClass('active');
if (vis) {
$(currentTab).hide();
} else {
$(currentTab).show();
}
});
});