veturi
veturi

Reputation: 1971

HTML anchors & links on fixed element

I have some target elements (<div name="target">) in my document and links to them are inside a fixed positioned element. (<a href="#target">).

Somehow the anchors and links don't work by default. Clicking the link inside the fixed positioned element doesn't do anything (the page doesn't scroll to where it should).

Target element has no gimmicks. It's just a div element inside few other div's.

Upvotes: 0

Views: 583

Answers (2)

Buhake Sindi
Buhake Sindi

Reputation: 89169

By doing this:

You're effectively saying that the link must go to an element in the document where the id is named "target"

so change,

<div name="target">

to

<div id="target">

Upvotes: 1

Pekka
Pekka

Reputation: 449385

IIRC, you need to assign an id instead of a name when doing this for elements other than <a> tags.

Upvotes: 5

Related Questions