If you apply a transition on an element for a particular supported property, and that property ever changes, it will use that transition. If a class name on that element changes and the new class changes that property, it will transition (assuming what that class does isn’t remove the transition). If JavaScript literally changes the that style property, it will transition.
Likewise, if a new media query takes affect, and that media query has something in it that changes that property on that element, it will transition. As such, there really isn’t a such thing as an “animated media query” so much as elements that just transition as expected when a new media query starts affecting the page.
Simple Example
.thing-that-moves {
position: absolute;
width: 100px;
height: 100px;
background: red;
top: 0;
left: 0;
transition: left 0.5s; /* BYO prefixes */
}
@media (min-width: 400px) {
left: 50px;
}
@media (min-width: 600px) {
left: 100px;
}
If you were to resize your browser window across those breakpoints, you’d see a red square moving around in response.
No comments:
Post a Comment