在iOS微信H5中,底部的横栏通常是由微信浏览器自带的导航栏所引起的。

以下3种方法可以尝试一下:

1.通过css样式来隐藏导航栏和底部横栏

body {
  margin-bottom: 0 !important;
}

#toolbar,
#bottombar {
  display: none !important;
}

2.通过iOS的特定CSS样式来隐藏导航栏和底部横栏

body {
  margin-bottom: constant(safe-area-inset-bottom) !important;
  margin-bottom: env(safe-area-inset-bottom) !important;
}

#toolbar,
#bottombar {
  display: none !important;
}

 3.切换到微信浏览器的全屏模式

WeixinJSBridge.call('hideToolbar');

不过,这些方法会因微信浏览器版本的不同有所变化,可能并不适用于所有的iOS微信H5环境。

一切还是以调试为主。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐