高级前端
js
【Q563】什么是媒体查询,JS 可以监听媒体查询吗

什么是媒体查询,JS 可以监听媒体查询吗

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 578 (opens in a new tab)

Author 回答者: haotie1990 (opens in a new tab)

MediaQueryList (opens in a new tab)

Author 回答者: shfshanyue (opens in a new tab)

TODO

Author 回答者: ethanlamm (opens in a new tab)

image

Author 回答者: renjianliuwang (opens in a new tab)

js也支持媒体查询,window. matchMedia()方法,参考文章:https://cloud.tencent.com/developer/article/2061082 (opens in a new tab)