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

jss.get() and media queries #38

Open
jnaklaas opened this issue Apr 20, 2016 · 0 comments
Open

jss.get() and media queries #38

jnaklaas opened this issue Apr 20, 2016 · 0 comments

Comments

@jnaklaas
Copy link

jnaklaas commented Apr 20, 2016

When using getAll(".classname") to get a css property, and the class has more than one occurance (in different media queries), jss always gets the class without media query, and not the active one.

I could've used it in my current project, as getComputedStyle() is also insufficient as the inline css also has the property i need to get.

basically, I need the transform property of the class in the current media query.

CSS:

.class {
   transform: scale(3); // i need this one when displayed on small screens
}
@media screen and (min-width: 1024px){
   .class {
      transform: scale(6); // i need this one when displayed on screens > 1024px
}

JS and screen > 1024px

document.querySelector(".class").style.transform = "scale(1)";

// ... other calculations

jss.getAll(".class").transform; // returns "scale(3)"
getComputedStyle(document.querySelector(".class")).transform; // returns "scale(1)"
// ????? // returns "scale(6)"

Cheers

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

1 participant