简体   繁体   English

几个链接在粘性导航菜单中不起作用

[英]Couple of links not working inside a sticky Navigation Menu

This is the website, http://girleducationproject.com/tempfile.html[1] The links in the navigation are all to anchors within the page except for the donate button and the donate link. 这是网站http://girleducationproject.com/tempfile.html[1] 。除了“捐赠”按钮和“捐赠”链接外,导航中的所有链接均指向页面内的锚点。 Clicking these two doesn't work but if right clicked they give the option to open link in new tab. 单击这两个按钮不起作用,但是如果右键单击它们,则会在新选项卡中提供打开链接的选项。 Please Advise. 请指教。 Thanks 谢谢

The problem is that you have bound a click event to all navigation items via onePageNav plugin. 问题是您已通过onePageNav插件将click事件绑定到所有导航项。

In your main.js add a filter in your navigation function: 在main.js中,在导航功能中添加一个过滤器:

// One Page Navigation
Navigation: function () {
    $('#menu').onePageNav({
        currentClass: 'current',
        scrollSpeed: 500,
        scrollOffset: 60,
        scrollThreshold: 0.2,
        easing: 'swing',
        filter: ':not(.external)' // <-- ADD THIS LINE
    });
},

Then, add a "external" class to your external links. 然后,在您的外部链接中添加一个“外部”类。 Should solve it. 应该解决它。

Another example is found in the docs (see Filter Example ): https://github.com/davist11/jQuery-One-Page-Nav#filter-example 在文档中找到了另一个示例(请参阅过滤器示例 ): https : //github.com/davist11/jQuery-One-Page-Nav#filter-example

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM