Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Fixed negative endLocation bug #25

Closed
wants to merge 1 commit into from
Closed

Conversation

a-v-l
Copy link
Contributor

@a-v-l a-v-l commented Jan 16, 2014

On sites using tht optional fixed header ('scrollHeader') an anchor might be placed above the fixed header. This leads to an negative 'endLocation' and therefore the interval 'runAnimation' will not be cleared.

@a-v-l a-v-l mentioned this pull request Jan 16, 2014
On sites using the optional fixed header ('scrollHeader') an anchor might be placed above the fixed header. This leads to an negative 'endLocation' and therefore the interval 'runAnimation' will never be cleared.
@cferdinandi
Copy link
Owner

@a-v-l - I appreciate the pull request, and wanted to let you know why I didn't implement it. Setting the endLocation variable to 0 when it's negative, you decrease the value of the distance variable, which is used to calculate the easing pattern. The scroll still stops at the right place, but the pattern would be thrown off.

Admittedly, the math behind the easing patterns is not my own, nor my area of expertise. But from looking at what the code is doing, it seems that changing the distance variable throws off the pattern.

Again, appreciate you finding this bug, though. Thanks!

@cferdinandi
Copy link
Owner

I just realized the error in my logic. The decreased value of the distance variable using your approach is actually more accurate, as it reflects the real distance the animation needs to travel. I'll update accordingly.

Thanks again!

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

Successfully merging this pull request may close these issues.

None yet

2 participants