探索关于手机适配的问题
jsvar isIPhoneX = /iphone/gi.test(window.navigator.userAgent)
&& window.devicePixelRatio
&& window.devicePixelRatio === 3
&& window.screen.width === 375
&& window.screen.height === 812;
jsvar isIPhoneXSMax = /iphone/gi.test(window.navigator.userAgent)
&& window.devicePixelRatio
&& window.devicePixelRatio === 3
&& window.screen.width === 414
&& window.screen.height === 896;
jsvar isIPhoneXR = /iphone/gi.test(window.navigator.userAgent)
&& window.devicePixelRatio
&& window.devicePixelRatio === 2
&& window.screen.width === 414
&& window.screen.height === 896;
依旧不用安全区域代码,如果要做刘海头 if (isIPhoneX || isIPhoneXSMax || isIPhoneXR) 垫高44px。 区分关键点:
1.是否需要考虑横屏情况 2.内补以及顶部固定显示需要动态控制显示
本文作者:seek
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!