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

Stops working if container it scrolled to the top #91

Open
jsd219 opened this issue Jan 29, 2021 · 3 comments
Open

Stops working if container it scrolled to the top #91

jsd219 opened this issue Jan 29, 2021 · 3 comments

Comments

@jsd219
Copy link

jsd219 commented Jan 29, 2021

Thank you for the great plugin!

I am having an issue where everything works as long as the container is NOT at top 0. What I mean is if the container has not been scrolled at all the links will not work but if I scroll the page just by 1 pixel the links will work. I provided a screen capture to demonstrate the issue.

As you can see in the example clip. When I first enter the page the links do not work but as soon as I scroll the page just 1 pixel the links work perfectly, then at the end of the clip you will see that I scroll the page back to the top (beginning) and the links stop working again.

I have tried every possible configuration. Any help would be greatly appreciated.

example_sized.mp4

Here is my current configuration

<scrollactive
scrollContainerSelector=".edit-user-unit-container"
class="team-container"
active-class="active" 
:offset="260"
:scrollOffset="160"
:modifyUrl="false">
    <a href="#truth" class="unit-icon scrollactive-item v-btn v-btn--flat v-btn--icon v-btn--round theme--dark v-size--default" :class="activecourse[0].course.baseYear">T</a>
    <a href="#equip" class="unit-icon scrollactive-item mt-3 v-btn v-btn--flat v-btn--icon v-btn--round theme--dark v-size--default" :class="activecourse[0].course.baseYear">E</a>
    <a href="#application" class="unit-icon scrollactive-item mt-3 v-btn v-btn--flat v-btn--icon v-btn--round theme--dark v-size--default" :class="activecourse[0].course.baseYear">A</a>
    <a href="#mission" class="unit-icon scrollactive-item mt-3 v-btn v-btn--flat v-btn--icon v-btn--round theme--dark v-size--default" :class="activecourse[0].course.baseYear">M</a>
    <a href="#supplication" class="unit-icon scrollactive-item mt-3 v-btn v-btn--flat v-btn--icon v-btn--round theme--dark v-size--default" :class="activecourse[0].course.baseYear">S</a>
</scrollactive>
@ventralnet
Copy link

Hello, I tracked this bug down to ScrollContainer.js

The getDistanceFromTop method returns this.container.scrollTop || this.container.pageYOffset. If you are at position 0 and you are spying on the window, then this.container.scrollTop will return undefined which will be returned. If container is a non window element, then this.container.pageYOffset will return undefined resulting in undefined being returned.

undefined being returned messes up future calculations down the road

@ventralnet
Copy link

If I have time this evening I can patch a submit a merge request, no promises though

@shahrizal96
Copy link

Wondering if this issue already fix or not? So far this plugin easy to use just need another touch up and it will be powerful.

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

3 participants