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

Not sticking when using sticky-side="bottom" with a data variable named bottom #30

Open
justwiebe opened this issue Oct 2, 2019 · 0 comments

Comments

@justwiebe
Copy link

My component was not sticking when I tried using string value of 'bottom' for sticky-side. After some investigation, I realized it's because I had a data attribute named bottom, and this line first checks if the Vue instance has a field named after the value, so my value of 'bottom' was being converted to 150.

This is easily fixed by renaming my variable, however it took a lot of time to figure out what the issue was. Perhaps consider moving the parameters into the directive in the form of an object (v-sticky="{ active: true, stickySide: 'bottom', stickyOffset: myDataObject }"). I believe this has the added benefit of being reactive, as well.

Another option would be creating a vue-sticky-component for more advanced options, which would allow the props to be reactive and would allow for visibility in the devtools for easier debugging.

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

No branches or pull requests

1 participant