Narabhut
Narabhut

Reputation: 837

HTML simple anchor link doesn't work in Chrome/Firefox

I'm making a portfolio page here (http://198.96.94.51/v2/) and while clicking on the navigationMenu links on the side really fast, they don't seem to redirect to the proper anchor (some of them don't move the page at all). I've initialized my anchor tags like this

<ol class="curtains">
    <li id="home" class="cover">
        <a id="home"></a>
        <header data-fade="550" data-slow-scroll="3">
            <h1>John Smith</h1>
            <h2>HOBBY/JOB TITLE</h2>
        </header>
    </li>
</ol>

My navbar code -

<ul id="navigationMenu">
    <li>
        <a class="home" href="#home">
            <span>Home</span>
        </a>
    </li>
    <li>
        <a class="about" href="#about">
            <span>About</span>
        </a>
    </li>
    <li>
         <a class="projects" href="#projects">
            <span>Projects</span>
         </a>
    </li>
    <li>
        <a class="resume" href="#resume">
            <span>Resume</span>
        </a>
    </li>
    <li>
        <a class="contact" href="#contact">
            <span>Contact us</span>
        </a>
    </li>
</ul>

But just clicking on the navbar, or even typing #home into the address bar won't bring the browser back to the top sometimes. Is there anything I'm doing wrong?

Upvotes: 1

Views: 15813

Answers (2)

Florian Kasper
Florian Kasper

Reputation: 496

Ids identify anchor points so they must be unique.

But if you just want to go to the top of the page you should try a simple # as value for your href attribute.

A link to the id of e.g. a <div> tag would lead you to this <div> tag.

<a href="#anchor"></a>

<div id="anchor"></div>

this fiddle shows you: http://jsfiddle.net/aYGFR/1/

Upvotes: 3

Balaji Kandasamy
Balaji Kandasamy

Reputation: 4506

You can give like this: <a id="home" href="home.php">Home</a>

Upvotes: 0

Related Questions