Browse Source

使用CSS固定定位防止iOS页面滚动

Boss
Default User 1 month ago
parent
commit
e057c09b4e
  1. 14
      supply.html

14
supply.html

@ -5783,6 +5783,11 @@
// 隐藏body滚动条,避免双滚动条 // 隐藏body滚动条,避免双滚动条
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
// 添加固定定位,防止iOS页面滚动
document.body.style.position = 'fixed';
document.body.style.width = '100%';
document.body.style.height = '100%';
// 防止iOS上的页面拖动 // 防止iOS上的页面拖动
preventiOSScrolling(); preventiOSScrolling();
@ -5971,6 +5976,11 @@
// 恢复body滚动条 // 恢复body滚动条
document.body.style.overflow = 'auto'; document.body.style.overflow = 'auto';
// 移除固定定位,恢复body样式
document.body.style.position = '';
document.body.style.width = '';
document.body.style.height = '';
// 恢复iOS页面滚动 // 恢复iOS页面滚动
restoreiOSScrolling(); restoreiOSScrolling();
@ -8971,6 +8981,10 @@
restoreiOSScrolling(); restoreiOSScrolling();
// 恢复body滚动条 // 恢复body滚动条
document.body.style.overflow = 'auto'; document.body.style.overflow = 'auto';
// 移除固定定位,恢复body样式
document.body.style.position = '';
document.body.style.width = '';
document.body.style.height = '';
} }
// 对于select-modal,使用移除active类来隐藏 // 对于select-modal,使用移除active类来隐藏
else if (modal.classList.contains('select-modal')) { else if (modal.classList.contains('select-modal')) {

Loading…
Cancel
Save