Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Add offset for content #105

Open
blueprintChris opened this issue Jun 13, 2019 · 3 comments
Open

Add offset for content #105

blueprintChris opened this issue Jun 13, 2019 · 3 comments

Comments

@blueprintChris
Copy link

Hi,

I have a fixed navbar at the top of my page. My content is on the left and my scrollspy is on the right. When I click on an element in scrollspy, my content scrolls to the correct id but the top bit of it is hidden by my nav bar. Offset doesn't work because it only offsets the scrollspy list.

Any ideas?

@blueprintChris
Copy link
Author

Adding padding-top to my anchor element really messes with my design. Adds too much white space. Any suggestion? Can you add a topOffset which takes a value and use that value to scroll that many pixels away from the top of the window?

@laurencefass
Copy link

have you tried adding padding-top and negative margin-top? its worked quite well in a few cases for me. also find adding margin-bottom on items preceeding them eliminates overlap.

@fadlystwn
Copy link

it's been a long time question, but I'm trying to help here.

I put the anchor on the section then hiding it with this stye

.anchor { display: block; position: relative; visibility: hidden; top: 100px; }
you can adjust the top both positive or negative value

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants