如何在@if语句中将window.innerHeight与Sass一起使用

如何在@if语句中将window.innerHeight与Sass一起使用,sass,Sass,我需要根据纵向视口是否真的很短来调整某个元素的大小(比如说一个小iPhone)。如果要在屏幕高度小于500px时执行Sass@if语句,我将如何结合使用vh 谢谢 您可以使用媒体查询,其工作原理如下:如果高度低于(xxx)do{xxx},我将给您一个可以使用sass实现的示例: // this query will be executes when the heigth is less than 500px @media only screen and (min-height: 500px)

我需要根据纵向视口是否真的很短来调整某个元素的大小(比如说一个小iPhone)。如果要在屏幕高度小于500px时执行Sass
@if
语句,我将如何结合使用
vh


谢谢

您可以使用媒体查询,其工作原理如下:如果高度低于(xxx)do{xxx},我将给您一个可以使用sass实现的示例:

// this query will be executes when the heigth is less than 500px
@media only screen and (min-height: 500px)
     .body
          // do what you want here

只需使用mediaqueries?您能在窗口调整大小的
@if
语句中检查媒体查询吗?