Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set an offset only for scrollspy #143

Open
talend-sromain opened this issue Sep 15, 2016 · 4 comments · May be fixed by #225
Open

Allow to set an offset only for scrollspy #143

talend-sromain opened this issue Sep 15, 2016 · 4 comments · May be fixed by #225

Comments

@talend-sromain
Copy link

In a screen i develop, i have some elements i want to spy in a left menu and when i click on them, i go smoothly to their position.

I set the offset to match the scroll position when i click, but theses elements don't take all the browser height, so, it's kind of weird when i scroll because scroll spy trigger only when the element ( with offset ) is on the top of the browser.

I suggest to add some behaviour to specify a prop, like spyOffset that can be use in spy algorithm if specified instead of offset.
If spyOffset is not defined, it take the offset if defined.

What do you think of this ?
As i need this feature, i can contribute to make it if you want.

@fisshy
Copy link
Owner

fisshy commented Sep 16, 2016

Hi,

A possible solution would be to add padding to your element instead of offset.

offset is calculated on using to/name and not with id.

@talend-sromain
Copy link
Author

Hi,

What i try to explain is that i want a different offset for scrollspy & scrollto.
When i click on my menu, i want to be around 50px offset of my element, however, when i scroll, i want the "active" class on my menu around 300px offset.
Actually, the active class is set on the same position as the scrollTo make us go.

I don't see how set a padding will solve this.

Do you want a codepen or similar to illustrate this ?

@malaniz
Copy link

malaniz commented Nov 25, 2016

I have the same trouble. It would be a nice feature. Is hard to explain and because of that i make this animated gif. http://imgur.com/a/NLFuh

@malaniz
Copy link

malaniz commented Nov 25, 2016

Btw, @talend-sromain i make this PR with the fix (you'll have the property scrolloffset to manage the changes active element on the menu)
#169

@tb tb linked a pull request Jun 16, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants