jss icon indicating copy to clipboard operation
jss copied to clipboard

jss.get() and media queries

Open jnaklaas opened this issue 8 years ago • 0 comments

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

jnaklaas avatar Apr 20 '16 10:04 jnaklaas