Href没有导航到相应的页面

时间:2015-11-30 06:41:20

标签: html href

            <div class="footer_links">

               <ul class="foot">
                   <li><a href="../about_us/about.html#companyVision">Company Vision<span class="underline"></span></a></li>
                   <li><a href="../about_us/about.html#mgtTeam">Management Team<span class="underline"></span></a></li>
                   <li><a href="../about_us/about.html#indLeadership">Industry Leadership<span class="underline"></span></a></li>
                   <li><a href="../about_us/about.html#ThoughtLead">Thought Leadership<span class="underline"></span></a></li>
                   <li><a href="../offerings/offer.html">Offerings<span class="underline"></span></a></li>
                   <li><a href="../contactus/contact.html">Contact Us<span class="underline"></span></a></li>
               </ul>

           </div>

在上面的代码中,我有4个页脚链接,它将导航到相应的页面。假设我点击“公司愿景”它将导航。但之后,如果我点击任何其他链接,它不导航。所有页面的页脚都相同。我正在检查点击事件是否正在发生,导航到链接后没有检测到。有人可以帮我这个。

1 个答案:

答案 0 :(得分:0)

这里的问题将是,第一次无论是哪个about.html#????你点击它第一次工作。但是,由于您已经在about.html页面上,因此在第一个点击后没有点击,因此请假设:

你在index.html中有这个菜单(你有相同的菜单)

<div class="footer_links">

           <ul class="foot">
               <li><a href="../about_us/about.html#companyVision">Company Vision<span class="underline"></span></a></li>
               <li><a href="../about_us/about.html#mgtTeam">Management Team<span class="underline"></span></a></li>
               <li><a href="../about_us/about.html#indLeadership">Industry Leadership<span class="underline"></span></a></li>
               <li><a href="../about_us/about.html#ThoughtLead">Thought Leadership<span class="underline"></span></a></li>
               <li><a href="../offerings/offer.html">Offerings<span class="underline"></span></a></li>
               <li><a href="../contactus/contact.html">Contact Us<span class="underline"></span></a></li>
           </ul>

       </div>

但在about.html页面中,您将其更改为

<div class="footer_links">

           <ul class="foot">
               <li><a href="#companyVision">Company Vision<span class="underline"></span></a></li>
               <li><a href="#mgtTeam">Management Team<span class="underline"></span></a></li>
               <li><a href="#indLeadership">Industry Leadership<span class="underline"></span></a></li>
               <li><a href="#ThoughtLead">Thought Leadership<span class="underline"></span></a></li>
               <li><a href="../offerings/offer.html">Offerings<span class="underline"></span></a></li>
               <li><a href="../contactus/contact.html">Contact Us<span class="underline"></span></a></li>
           </ul>

       </div>

但最后我会建议您更改文件/文件夹结构

从:

  • sitefolder /
    • 的index.html
    • about_us /
      • about.html
    • 产品/
      • offer.html
    • 联系我们/
      • contact.html

  • sitefolder /
    • 的index.html
    • about.html
    • offer.html
    • contact.html

所以你可以有一个更简单的菜单(所有页面都相同):

<div class="footer_links">

       <ul class="foot">
           <li><a href="about.html#companyVision">Company Vision<span class="underline"></span></a></li>
           <li><a href="about.html#mgtTeam">Management Team<span class="underline"></span></a></li>
           <li><a href="about.html#indLeadership">Industry Leadership<span class="underline"></span></a></li>
           <li><a href="about.html#ThoughtLead">Thought Leadership<span class="underline"></span></a></li>
           <li><a href="offer.html">Offerings<span class="underline"></span></a></li>
           <li><a href="contact.html">Contact Us<span class="underline"></span></a></li>
       </ul>

   </div>

在您的网站上签入后,它似乎正在使用jQuery加载标签,所以我通过在每个页脚链接上添加它来使其工作

onClick="window.location.reload()