2017-07-17 43 views
-2

I am editing a template and links don't respond to left clicks. If you right-click and choose 'Open in New Tab,' they work just fine. When you hover over them, you can see the URL in the status bar at the bottom of the browser.<a href=""> links don't open when I click on it but works when I click "open in new tab"

I will only post the menu section of the index file since the webpage is too long. Please download the template from the following link to see it yourselfClick Here

我在这里是新的,所以我不清楚发布问题的规则。让我知道如果你需要其他信息,请帮助我。

`

  <nav class="navbar navbar-light"> 
       <ul class="nav navbar-nav single-page-nav"> 
       <li class="nav-item"> 
        <a class="nav-link" href="#home">Home <!-- <span class="sr-only">(current)</span> --></a> 
       </li> 
       <li class="nav-item"> 
        <a class="nav-link" href="gallery.html">Products</a> 
       </li> <!-- this link won't work --> 

       <li class="nav-item"> 
        <a class="nav-link" href="#about">About</a> 
       </li> 
       <li class="nav-item"> 
        <a class="nav-link" href="#contact">Contact</a> 
       </li> 

       </ul> 
      </nav> 

     </div>`. 

<div class="sigma-content col-lg-6 col-md-6 photo text-center" > 
      <h2></h2> 
     <a href="gallery.html" class="btn btn-primary btn-lg">VISIT OUR GALLERY</a> 
     </div> 

编辑:我刚刚了解浏览器控制台和错误是

Uncaught Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/) 
at bootstrap.min.js:7 
at bootstrap.min.js:7 
at bootstrap.min.js:7 

我该如何解决这个问题。

+2

必须有一些防止默认行为的代码 – brk

+0

是的,一定有一些js代码阻止浏览器控制台的默认行为检查。 –

+0

你能帮我找到那个代码吗?它可能是Javascript ..我真的很糟糕。 –

回答

0

的链接模板显示了live demo的快速检查,在源的底部(帧源,而不是页面的源代码)验证码

// The actual plugin 
$('.single-page-nav').singlePageNav({ 
    offset: $('.single-page-nav').outerHeight(), 
    filter: ':not(.external)', 
    updateHash: true, 
    beforeStart: function() { 
    console.log('begin scrolling'); 
    }, 
    onComplete: function() { 
    console.log('done scrolling'); 
    } 
}); 

它看起来像它的使用this library其中规定

Clicking on any links within the container will cause an animated scroll down to the element whose ID is identified by that link's "hash" (if it exists)

,然后在选项

'filter' - By default, the plugin will be applied to all links within the container, use this to filter out certain links using jquery's built in filter method (e.g. ':not(.external)')

所以,因为在现场演示的代码有filter: ':not(.external)',我假设你有你的页面上,以及(既然你<ul>有类)改变

<a class="nav-link" href="gallery.html">Products</a> 

<a class="nav-link external" href="gallery.html">Products</a> 

应该修复你的问题

+0

哇,这真棒..它真的可以工作。你能告诉我如何添加外部链接。代码是什么?非常感谢你的帮助。 –

相关问题