Menu icon Foundation
Add/Remove Class Based On Orientation

I know Foundation has the visibility classes for orientation, but I was wondering if there was someway to have a certain (custom) class take effect on a div depending on whether or not the orientation was a given direction. Does Foundation have any good way of doing this or should I just rely on JS here?

orientationclass

I know Foundation has the visibility classes for orientation, but I was wondering if there was someway to have a certain (custom) class take effect on a div depending on whether or not the orientation was a given direction. Does Foundation have any good way of doing this or should I just rely on JS here?

This post has been closed. No new replies can be added.

Karl Ward over 5 years ago

.myStyle {
   // globally applied styles
}
@media (orientation: landscape) {
   .myStyle {
      // Styles that apply on the class on landscape orientation
   }
}
@media (orientation: portrait) {
   .myStyle {
      // Styles that apply on the class on landscape orientation
   }
}