0

After clicking a link I am redirected to a new page where the scrolling stops at a specific div. However, the specific div is underneath the header so it doesn't show the correct div.

Is there anyway i can make the scrolling stop at the specific div while having a fixed/sticky header with jquery or any other simple solution?

Here is the HTML code I currently have:

      <div class="faq-section col-md-6 col-sm-12 col-sm-12">
        <h3>OFTE STILTE SPØRSMÅL</h3>
        <ul class="list-unstyled">
          <li><i class="fa fa-arrow-right"></i><a href="leveranse/#questionOne">Hvor lang tid tar det før jeg får varen jeg har bestilt?</a></li>
          <li><i class="fa fa-arrow-right"></i><a href="betalinger/#questionTwo">Hvilken betalingsmetoder godtar dere i nettbutikken?</a></li>
          <li><i class="fa fa-arrow-right"></i><a href="retur-og-bytte/#questionThree">Hvordan returnerer jeg en vare?</a></li>
          <li><i class="fa fa-arrow-right"></i><a href="leveranse/#questionFour">Hvilke land leverer dere til?</a></li>
          <li><i class="fa fa-arrow-right"></i><a href="leveranse/#questionFive">Hvor lang returrett har jeg på bestillingen?</a></li>
        </ul>            
      </div>

Let me know if you need any other code.

NohmanJ
  • 167
  • 3
  • 15
  • 1
    Possible duplicate of [HTML position:fixed page header and in-page anchors](http://stackoverflow.com/questions/4086107/html-positionfixed-page-header-and-in-page-anchors) – Brett DeWoody Jan 25 '16 at 16:02
  • @BrettDeWoody I tried following the link, it worked, but it creates unecessary padding where the div is supposed to stop. Is there any other solution? – NohmanJ Jan 25 '16 at 16:21
  • My recommendation is create an empty `` tag at the location you want to scroll to. Then apply the CSS offset to the `anchorLink` class. – Brett DeWoody Jan 25 '16 at 16:24
  • I agree with @BrettDeWoody, this is how I've solved this in the past. However, I believe blank links will fail Sec 508 compliance, so something to keep in mind. Can anyone else chime in? – Pdnell Jan 25 '16 at 16:25
  • Good consideration @Pdnell. Perhaps a `hidden` or `aria-hidden` attribute? – Brett DeWoody Jan 25 '16 at 16:35

0 Answers0