I'm facing a strange issue. The title pretty much sums it up. Here's a snippet of the code:
<a href="#test1">Go to test 1</a>
<a href="#test2">Go to test 2</a>
<a href="#test3">Go to test 3</a>
<a href="#test4">Go to test 4</a>
<a href="#test5">Go to test 5</a>
<a href="#test6">Go to test 6</a>
<a href="#test7">Go to test 7</a>
<a href="#test8">Go to test 8</a>
<div id="test1">Some text for test 1</div>
<div id="test2">Some text for test 2</div>
<div id="test3">Some text for test 3</div>
<div id="test4">Some text for test 4</div>
<div id="test5">Some text for test 5</div>
<div id="test6">Some text for test 6</div>
<div id="test7">Some text for test 7</div>
<div id="test8">Some text for test 8</div>
In my case, this is just a demo and in reality, my page has more content so the "jumping" effect is more noticeable. This piece of code seems not to be working (at least for me). It only adds a #test to the link but doesn't scroll down to the respective section. Any idea what I might be doing wrong? Thanks in advance. And pardon my English, as it's not my native language.
Edit: So, on my website, when using such links I wanted to move to a div that is positioned above the link, which was not functioning properly. But then I moved the target div below the link and it started working. Is there any way for such links to move to higher placed divs?