我有一个问题,就是如何用JS 编写一个完整的css @media查询,用屏幕大小和屏幕方向(例如下面的例子)来反映完整的css@media查询,我所能找到的只是一个单独的大小(没有方向)和方向(没有大小)的示例。这个CSS示例的正确语法是什么:
@media only screen and (min-width: 483px) and (orientation: landscape) {}在此代码中:
if (window.matchMedia("(orientation: portrait)").matches) {
// how to add a screen size to this exact code?
}发布于 2018-09-06 10:41:42
它和CSS是一样的。这就是关键所在。
window.matchMedia("only screen and (min-width: 483px) and (orientation: landscape)").matcheshttps://stackoverflow.com/questions/52202184
复制相似问题