Simple way to identify iOS user agent in a jQuery if/then statement?

前端 未结 6 2031
心在旅途
心在旅途 2021-02-01 03:16

Exactly like it sounds..

Is there some magical and easy way to say:

    if (user agent is iOS) {
        if (browserRatio >=1.5) {
            $contai         


        
6条回答
  •  执笔经年
    2021-02-01 03:43

    I know you're asking about jquery in particular, but IMO, you almost certainly want to use CSS3 @media queries for this. There's even support for testing for landscape or portrait orientation.

    @media (orientation:landscape) {
      .container_selector {
        min-height: 555px;
      }
    }
    @media (orientation:portrait) {
      .container_selector {
        min-height: 360px;
      }
    }
    

    Hope this helps!

提交回复
热议问题