0

I tried to make a link to a section on a one page. It works strangely sometimes, but mostly it gets stuck at the section where you clicked the item and then if you want to scroll manually it does not work at all.

As far as I have seen on the Internet, there is no more to do than creating an a tag with href="#someID" and then clicking it, it should take me to the corresponding id or am I missing something?

<div>
  <div class="content-wrapper">
    <div class="v-center">
      <div class="main-content" style="margin-top: 200px">
        <p> Some Text </p>
        <ul>
          <li><a href="#anmeldungsprobleme">Problem Collection<br></a></li>
          <li><a href="#anmeldungJA">Specific Problem1<br></a></li>
          <li><a href="#anmeldungNEIN">Specific Problem2<br></a></li>
          <li><a href="#">Specific Problem3<br></a></li>
        </ul>
      </div>
    </div>
  </div>

  <div style="margin-top: 400px">
    <div>
      <div id="anmeldungsprobleme">
        <h2>IDC Anmeldung schlägt generell fehl</h2>
      </div>
      <div>
        <p>Descriptive Text</p>
        <p style="color: green"> Username: Placeholder<br> Passwort: *********</p>
      </div>
    </div>
  </div>

  <div id="anmeldungJA">
    <h3>Anmeldung ist möglich</h3>
    <p>Text about the problem</p>
  </div>
</div>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
MadPat
  • 23
  • 3
  • And what are the symptoms? Perhaps you have more than one of the same IDs? They MUST be unique on the page. The code you posted here works except `anmeldungNEIN` and `#`. Also in your example you cannot go to anmeldungJA because it is not far enough away from anmeldungsprobleme – mplungjan Sep 25 '17 at 12:58
  • Yes, the problem is that your ID's are not unique. – KIKO Software Sep 25 '17 at 12:59
  • @KIKOSoftware Which ones? – ProEvilz Sep 25 '17 at 13:00
  • @ProEvilz: Well, that's quite obvious: `id="anmeldungJA"` and `id="anmeldungsprobleme"`. – KIKO Software Sep 25 '17 at 13:01
  • 2
    You quote two **different** `id`'s and say that it is obvious they're not unique? – ProEvilz Sep 25 '17 at 13:01
  • 1
    @madpat Your snippet works fine for me. It scrolls and I don't get 'stuck' ? Do you mean that you can't scroll further past `Anmeldung ist möglich` section or what... I'm not sure what the problem is here. – ProEvilz Sep 25 '17 at 13:03
  • Clicking `#anmeldungNEIN` link won't work as there is no section in the HTML with that `ID` – ProEvilz Sep 25 '17 at 13:04
  • @ProEvilz By getting stuck I mean at the top of the page where the a href is. I click it, the whole screen wobbles and when I try to scroll down to the section it returns back on top until I reload the page. Yes that ID i just added now, it strangely works aslong as there is only anmeldungsprobleme, after adding a second it starts crashing. – MadPat Sep 25 '17 at 13:06

1 Answers1

0

Thank you so mcuh for your help @ProEvilz I tried it outside of my IDE and now it works... Seems to be a problem inside of brackets.

MadPat
  • 23
  • 3
  • Good to see you got it sorted. Accept your own answer when you can so that people know this is closed. – ProEvilz Sep 25 '17 at 13:13