2017-07-17 69 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

哇,這真棒..它真的可以工作。你能告訴我如何添加外部鏈接。代碼是什麼?非常感謝你的幫助。 –

相關問題