简体   繁体   English

使用WayPoints js从我的导航栏中打开外部html页面

[英]Opening an external html page from my Navbar using WayPoints js

I have a navbar with links to divs in my html page. 我的html页面中有一个带有指向div链接的导航栏。 One of the links however is an external html page. 但是,链接之一是外部html页面。 Clicking the link to the html page doesn't work and I can't figure out why. 单击指向html页面的链接不起作用,我不知道为什么。 In my waypoints function, I have something like this: 在我的航点功能中,我有这样的东西:

$('#home, login.html, #about, designs, #services, #contact').waypoint(function() {
    activenav($(this));
}, { offset: function() {
    return -$(this).height()+52;
  }});
$('#home, login.html, #about, designs, #services, #contact').waypoint(function() {
    activenav($(this));
}, { offset: '51px' });

This is my navbar: 这是我的导航栏:

<nav>
        <ul class="nav masthead-nav">
            <li class="active"><a href="#home">Home</a></li>
            <li><a href="login.html" rel="nofollow" target="_blank">Login</a></li>
            <li><a href="#about">About Us</a></li>
            <li><a href="#designs">Interior Designs</a></li>
            <li><a href="#services">Our Services</a></li>
            <li><a href="#contact">Contact</a></li>
        </ul>
    </nav>

Any suggestions? 有什么建议么?

I think you're misusing the jQuery $('') selector syntax . 我认为您在滥用jQuery $('')选择器语法 You need to select the elements by the value of their href attribute like this this: 您需要通过href属性选择元素,如下所示:

$('[href="value_of_href"]')

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

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