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

volume control fix on scroll #430

Merged
merged 5 commits into from
Sep 19, 2019
Merged

Conversation

RobinGiel
Copy link

According to MDN: For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatible example:

`var supportPageOffset = window.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");

var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop; `

https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes

Tested on Firefox, Chrome, Safari, Edge and Internet Explore

Copy link
Owner

@benwiley4000 benwiley4000 left a comment

Choose a reason for hiding this comment

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

Looks great! One suggestion.. thank you!

scrollTop = document.body.scrollTop;
scrollLeft = document.body.scrollLeft;
const supportPageOffset = window.pageXOffset !== undefined;
const isCSS1Compat = (document.compatMode || '') === 'CSS1Compat';
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can skip "isCSS1Compat" so get rid of all the stuff with document.documentElement.

Copy link
Author

Choose a reason for hiding this comment

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

the problem is that document.documentElement is supported for Ie: https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement

so I think we might need it.

this is another suggestion:

const supportPageOffset = window.pageXOffset !== undefined;
const BackCompat = document.compatMode === 'BackCompat';

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Ok i removed document.documentElement :-) I can confirm that everything is still working

Copy link
Owner

@benwiley4000 benwiley4000 left a comment

Choose a reason for hiding this comment

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

Great thank you!!

@benwiley4000 benwiley4000 merged commit d8b65b5 into benwiley4000:next Sep 19, 2019
@benwiley4000
Copy link
Owner

I will try to make a new release tonight.. remind me if I forget. Thanks again!

@RobinGiel
Copy link
Author

@benwiley4000 just a reminder for the release :-)

@benwiley4000
Copy link
Owner

benwiley4000 commented Sep 26, 2019 via email

@benwiley4000
Copy link
Owner

Does this close #407?

@benwiley4000
Copy link
Owner

@RobinGiel I just published v2.0.0-beta.4! Thanks. And sorry again for the wait.

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.

2 participants