0

I'm working on a site with a Sticky Navigation and when I use

<a href="#example">Example Link</a>

the Sticky Nav overlaps the top of the #example.

The Nav height is 70px so I'm wondering if there's any way to link to #example but start 70px down. I'd rather not create an additional ID since it will probably make things a mess.

Any ideas?

doniyor
  • 36,596
  • 57
  • 175
  • 260
Axion
  • 682
  • 4
  • 20

2 Answers2

1

You can use

window.scrollBy(0,70);

to scroll the window 70px down.

To have it actually scroll after linking, you have to change your link such that it executes a javascript relocation before scrolling: window.location='#example'; window.scrollBy(0,70);

Larkeith
  • 434
  • 2
  • 9
0

That is the job of #example. It moves you to the location of the element with that id.

You can use jQuery to animate your elements to slideUp or your window to scrollTo 70px down.

Afzaal Ahmad Zeeshan
  • 15,669
  • 12
  • 55
  • 103