-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
6.4.1: Foundation.MediaQuery.current empty when including foundation.util.mediaQuery separately #10363
Comments
Hi @kitsimons |
Awesome, thanks @kball |
@kball I just ran into this same issue using 6.4.3. I'm using webpack and am trying to import MediaQuery into one of my files, like this:
Later in the file, Should the call to |
@flyingL123 does this still occur in 6.5.0 RC1? |
Yes @DanielRuf it still occurs because the |
cc @ncoden should we reopen this? |
@DanielRuf just to clarify, I am importing |
The MediaQuery utility is not initialized when imported via the global Foundation package. Not before a component using it is used This commit does the same as foundation#10363 but for the global Foundation entry. See foundation#10363
I seem to have this problem to, with v6.5.0-rc.2. I load the MediaQuery module like this:
Even if I call |
@flyingL123 The entries files are dedicated to a "ready-to-use" import, like in a browser environment. So yes, you may need to import the entry plugin instead if you do not want to call |
@kristiansp Did you imported the Foundation CSS or included the Sass mixin |
Yes, I do have the
So I'm guessing that it's not able to read the breakpoints out of my One more thing, and I'm a bit out of my depth here, but looking in the I have no idea of the logic here, but I don't see how that would load my breakpoints? |
Can you provide a codepen or some info so we can see where you load your JS (at the bottom of body or in the head)? |
@DanielRuf This is at the moment the very end of my HTML document (I moved the code below initialising Foundation from a custom.js file to here, to see if there was something with the order things were loaded). I've also tried initialising with and without
|
@kristiansp Also could you send the styles of the |
@ncoden What is the best way to extract the styles? I see the element with the inspector, but it actually doesn't seem to have any styles at all. |
$('.foundation-mq').css('font-family'); |
When I print it in the console that gives me:
So it might seem to be going for some Times New Roman here? ;-) (Btw, that's not my website's font 😃) |
@kristiansp This means that the |
@ncoden Turns out you were right. Adding Btw, should I wrap Thanks for the help! |
@kristiansp It depends on when you know your page is ready and if you have dynamically created component. Just try to initialize Foundation as soon as possible, but not before all component are there (or manually initialize them later). |
I'm importing
foundation.core
andfoundation.util.mediaQuery
separately. Subsequently usingFoundation.MediaQuery.current
returns an empty string.If I import
foundation
(everything) rather than the components, usingFoundation.MediaQuery.current
returns the current breakpoint as expected.So this;
Returns an empty string.
Whereas this;
Returns the current breakpoint.
This appears to be an issue with 6.4.1 (everything works as expected in 6.3.1)
The text was updated successfully, but these errors were encountered: