PhoneGap + Android + media queries

后端 未结 2 442
抹茶落季
抹茶落季 2021-02-06 16:47

I have been struggling with this for a week now. I have read tons of posts/webs/tips&tricks, but I just can\'t figure this out.

I need to set CSS rules for different

2条回答
  •  一整个雨季
    2021-02-06 17:26

    Have you tried it using javascript to see what is being returned by the media query, to check the results?

    var mq = window.matchMedia( "only screen and (max-width: 600px) and (max-height: 1024px) and (orientation: portrait)" );  
    
    if (mq.matches) {
        // window width is exactly 600x1024 and portrait
    }
    else {
        // window width is exactly 600x1024 and portrait
    }
    

    Link for reference.

提交回复
热议问题