Skip to content

Conversation

@asselin
Copy link

@asselin asselin commented May 6, 2017

Issue #45 shows an issue where if the parent element is position:fixed, smoothscroll tries to scroll the body to scroll it to the top of the viewport. position:fixed elements never move of course, so in this case, it shouldn't do anything to the scrollpos of the body.

top: parentRects.top,
behavior: 'smooth'
});
if (w.getComputedStyle(scrollableParent).position != 'fixed') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Now, can you switch this to !==? Strict equality comparison is preferable since its usually faster. Also, add a comment on top of the ìf` statement explaining why the hard check, something like Avoid scrolling fixed positioned parent.

Thanks in advance!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not picking up that this library uses === coding convention, fixed that and added a comment.

@jeremenichelli
Copy link
Collaborator

@asselin nothing to be sorry mna, thanks for your contribution. We are going to make this easier and inform when there's a lint issue beforehand.

@jeremenichelli
Copy link
Collaborator

Thanks! Sadly, this PR and others are entering in conflict (https://github.com/iamdustan/smoothscroll/pull/73/files) so I'm gonna manually pick up the work of each to simplify the release and be equally fair with everyone since someone would need to resolve the conflicts no matter the other I chose.

I'm gonna make a PR and put you as a reviewer so you can check your changes.

@kaankucukx
Copy link

hey, i was looking for this. seems @asselin havent reviewed the conflict. :)

Cmon publish this please.

Thanks.

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 this pull request may close these issues.

3 participants