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

Media Check goes into every media query on page load #27

Open
csamoiloff opened this issue Jan 19, 2016 · 0 comments
Open

Media Check goes into every media query on page load #27

csamoiloff opened this issue Jan 19, 2016 · 0 comments

Comments

@csamoiloff
Copy link

When you first load a page, mediaCheck goes into every media query, even if it’s not relevant, which then triggers an exit event. (e.g. media: '(min-width: 64.063em)' is entered even if the browser width is less than 64.063em). I had to get around it by setting a flag and using it in all of the exit functions (if (vInitialCheck) return;) except for the last one, where I reset the flag (if (vInitialCheck) {vInitialCheck = false; return;} Is there a way to add this to the main code? I don't think functions should ever get run unless you actually are in a valid media query for the browser size.

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