<a href=""> links don&#39;t open when I click on it but works when I click &#34;open in new tab&#34;

时间:2017-07-17 05:09:29

标签: javascript html

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.

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 yourself Click 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

我该如何解决这个问题。

1 个答案:

答案 0 :(得分: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状态

  

单击容器中的任何链接将导致动画向下滚动到其ID由该链接的“哈希”标识的元素(如果存在)

然后在选项中

  

'filter' - 默认情况下,该插件将应用于容器中的所有链接,使用此过滤器使用jquery的内置过滤器方法过滤掉某些链接(例如':not(.external)')

因此,由于现场演示中的代码有filter: ':not(.external)',我认为您的页面上也有此代码(并且由于您的<ul>single-page-nav类),因此更改< / p>

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

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

应解决您的问题

相关问题